Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

bcache: allocate meta data pages as compound pages

There are some meta data of bcache are allocated by multiple pages,
and they are used as bio bv_page for I/Os to the cache device. for
example cache_set->uuids, cache->disk_buckets, journal_write->data,
bset_tree->data.

For such meta data memory, all the allocated pages should be treated
as a single memory block. Then the memory management and underlying I/O
code can treat them more clearly.

This patch adds __GFP_COMP flag to all the location allocating >0 order
pages for the above mentioned meta data. Then their pages are treated
as compound pages now.

Signed-off-by: Coly Li <colyli@suse.de>
Cc: stable@vger.kernel.org
Signed-off-by: Jens Axboe <axboe@kernel.dk>

authored by

Coly Li and committed by
Jens Axboe
5fe48867 6acd193b

+5 -5
+1 -1
drivers/md/bcache/bset.c
··· 322 322 323 323 b->page_order = page_order; 324 324 325 - t->data = (void *) __get_free_pages(gfp, b->page_order); 325 + t->data = (void *) __get_free_pages(__GFP_COMP|gfp, b->page_order); 326 326 if (!t->data) 327 327 goto err; 328 328
+1 -1
drivers/md/bcache/btree.c
··· 785 785 mutex_init(&c->verify_lock); 786 786 787 787 c->verify_ondisk = (void *) 788 - __get_free_pages(GFP_KERNEL, ilog2(bucket_pages(c))); 788 + __get_free_pages(GFP_KERNEL|__GFP_COMP, ilog2(bucket_pages(c))); 789 789 790 790 c->verify_data = mca_bucket_alloc(c, &ZERO_KEY, GFP_KERNEL); 791 791
+2 -2
drivers/md/bcache/journal.c
··· 999 999 j->w[1].c = c; 1000 1000 1001 1001 if (!(init_fifo(&j->pin, JOURNAL_PIN, GFP_KERNEL)) || 1002 - !(j->w[0].data = (void *) __get_free_pages(GFP_KERNEL, JSET_BITS)) || 1003 - !(j->w[1].data = (void *) __get_free_pages(GFP_KERNEL, JSET_BITS))) 1002 + !(j->w[0].data = (void *) __get_free_pages(GFP_KERNEL|__GFP_COMP, JSET_BITS)) || 1003 + !(j->w[1].data = (void *) __get_free_pages(GFP_KERNEL|__GFP_COMP, JSET_BITS))) 1004 1004 return -ENOMEM; 1005 1005 1006 1006 return 0;
+1 -1
drivers/md/bcache/super.c
··· 1784 1784 } 1785 1785 1786 1786 #define alloc_bucket_pages(gfp, c) \ 1787 - ((void *) __get_free_pages(__GFP_ZERO|gfp, ilog2(bucket_pages(c)))) 1787 + ((void *) __get_free_pages(__GFP_ZERO|__GFP_COMP|gfp, ilog2(bucket_pages(c)))) 1788 1788 1789 1789 struct cache_set *bch_cache_set_alloc(struct cache_sb *sb) 1790 1790 {