minor improvement to abd_free_pages()
It doesn't need to have a loop to free page in a single scatterlist entry because it should be single or compound page. The pages can be freed in one invocation to __free_pages() for both cases. Reviewed-by: Gvozden Neskovic <neskovic@gmail.com> Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Reviewed-by: Richard Yao <ryao@gentoo.org> Signed-off-by: Jinshan Xiong <jinshan.xiong@gmail.com> Closes #6057
This commit is contained in:
parent
24fa20340d
commit
2b91b5119c
|
@ -374,7 +374,7 @@ abd_free_pages(abd_t *abd)
|
|||
struct sg_table table;
|
||||
struct page *page;
|
||||
int nr_pages = ABD_SCATTER(abd).abd_nents;
|
||||
int order, i, j;
|
||||
int order, i;
|
||||
|
||||
if (abd->abd_flags & ABD_FLAG_MULTI_ZONE)
|
||||
ABDSTAT_BUMPDOWN(abdstat_scatter_page_multi_zone);
|
||||
|
@ -383,13 +383,11 @@ abd_free_pages(abd_t *abd)
|
|||
ABDSTAT_BUMPDOWN(abdstat_scatter_page_multi_chunk);
|
||||
|
||||
abd_for_each_sg(abd, sg, nr_pages, i) {
|
||||
for (j = 0; j < sg->length; ) {
|
||||
page = nth_page(sg_page(sg), j >> PAGE_SHIFT);
|
||||
order = compound_order(page);
|
||||
__free_pages(page, order);
|
||||
j += (PAGESIZE << order);
|
||||
ABDSTAT_BUMPDOWN(abdstat_scatter_orders[order]);
|
||||
}
|
||||
page = sg_page(sg);
|
||||
order = compound_order(page);
|
||||
__free_pages(page, order);
|
||||
ASSERT3U(sg->length, <=, PAGE_SIZE << order);
|
||||
ABDSTAT_BUMPDOWN(abdstat_scatter_orders[order]);
|
||||
}
|
||||
|
||||
table.sgl = ABD_SCATTER(abd).abd_sgl;
|
||||
|
|
Loading…
Reference in New Issue