bcachefs: Use __GFP_ACCOUNT for reclaimable memory

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
This commit is contained in:
Kent Overstreet 2024-09-03 17:42:53 -04:00
parent 4645855df0
commit 895fbf1cf0
2 changed files with 4 additions and 0 deletions

View File

@ -102,6 +102,8 @@ static int btree_node_data_alloc(struct bch_fs *c, struct btree *b, gfp_t gfp)
{ {
BUG_ON(b->data || b->aux_data); BUG_ON(b->data || b->aux_data);
gfp |= __GFP_ACCOUNT|__GFP_RECLAIMABLE;
b->data = kvmalloc(btree_buf_bytes(b), gfp); b->data = kvmalloc(btree_buf_bytes(b), gfp);
if (!b->data) if (!b->data)
return -BCH_ERR_ENOMEM_btree_node_mem_alloc; return -BCH_ERR_ENOMEM_btree_node_mem_alloc;

View File

@ -118,6 +118,8 @@ static void bkey_cached_free(struct btree_key_cache *bc,
static struct bkey_cached *__bkey_cached_alloc(unsigned key_u64s, gfp_t gfp) static struct bkey_cached *__bkey_cached_alloc(unsigned key_u64s, gfp_t gfp)
{ {
gfp |= __GFP_ACCOUNT|__GFP_RECLAIMABLE;
struct bkey_cached *ck = kmem_cache_zalloc(bch2_key_cache, gfp); struct bkey_cached *ck = kmem_cache_zalloc(bch2_key_cache, gfp);
if (unlikely(!ck)) if (unlikely(!ck))
return NULL; return NULL;