FS/XFS testing framework
 help / color / mirror / Atom feed
From: Mikulas Patocka <mpatocka@redhat.com>
To: Kent Overstreet <kent.overstreet@linux.dev>
Cc: Zorro Lang <zlang@kernel.org>,
	"Darrick J. Wong" <djwong@kernel.org>,
	fstests@vger.kernel.org
Subject: [PATCH] bcachefs: mark bch_inode_info and bkey_cached as reclaimable
Date: Thu, 13 Jul 2023 18:00:28 +0200 (CEST)	[thread overview]
Message-ID: <ea7fe56-dbac-27b8-33cc-5c722f366e63@redhat.com> (raw)

Mark these caches as reclaimable, so that available memory is correctly
reported when there is a lot of cached inodes.

Note that more work is needed - you should add __GFP_RECLAIMABLE to some 
of the kmalloc calls, so that they are allocated from the "kmalloc-rcl-*" 
caches.

Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>

---
 fs/bcachefs/btree_key_cache.c |    2 +-
 fs/bcachefs/fs.c              |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

Index: bcachefs/fs/bcachefs/btree_key_cache.c
===================================================================
--- bcachefs.orig/fs/bcachefs/btree_key_cache.c
+++ bcachefs/fs/bcachefs/btree_key_cache.c
@@ -1079,7 +1079,7 @@ void bch2_btree_key_cache_exit(void)
 
 int __init bch2_btree_key_cache_init(void)
 {
-	bch2_key_cache = KMEM_CACHE(bkey_cached, 0);
+	bch2_key_cache = KMEM_CACHE(bkey_cached, SLAB_RECLAIM_ACCOUNT);
 	if (!bch2_key_cache)
 		return -ENOMEM;
 
Index: bcachefs/fs/bcachefs/fs.c
===================================================================
--- bcachefs.orig/fs/bcachefs/fs.c
+++ bcachefs/fs/bcachefs/fs.c
@@ -1926,7 +1926,7 @@ int __init bch2_vfs_init(void)
 {
 	int ret = -ENOMEM;
 
-	bch2_inode_cache = KMEM_CACHE(bch_inode_info, 0);
+	bch2_inode_cache = KMEM_CACHE(bch_inode_info, SLAB_RECLAIM_ACCOUNT);
 	if (!bch2_inode_cache)
 		goto err;
 


             reply	other threads:[~2023-07-13 16:02 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-13 16:00 Mikulas Patocka [this message]
2023-07-14 17:12 ` [PATCH] bcachefs: mark bch_inode_info and bkey_cached as reclaimable Kent Overstreet
2023-07-17 13:27   ` Mikulas Patocka

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ea7fe56-dbac-27b8-33cc-5c722f366e63@redhat.com \
    --to=mpatocka@redhat.com \
    --cc=djwong@kernel.org \
    --cc=fstests@vger.kernel.org \
    --cc=kent.overstreet@linux.dev \
    --cc=zlang@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox