All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dave Chinner <david@fromorbit.com>
To: Shaohua Li <shli@fb.com>
Cc: linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org,
	Kernel-team@fb.com, viro@zeniv.linux.org.uk
Subject: Re: [RFC] put more pressure on proc/sysfs slab shrink
Date: Sat, 22 Oct 2016 10:00:07 +1100	[thread overview]
Message-ID: <20161021230007.GV23194@dastard> (raw)
In-Reply-To: <bca13f1ae6a72f0d126cd7e9ede11baaa2b81064.1477081587.git.shli@fb.com>

On Fri, Oct 21, 2016 at 01:35:14PM -0700, Shaohua Li wrote:
> In our systems, proc/sysfs inode/dentry cache use more than 1G memory
> even memory pressure is high sometimes. Since proc/sysfs is in-memory
> filesystem, rebuilding the cache is fast. There is no point proc/sysfs
> and disk fs have equal pressure for slab shrink.
> 
> One idea is directly discarding proc/sysfs inode/dentry cache rightly
> after the proc/sysfs file is closed. But the discarding will make
> proc/sysfs file open slower next time, which is 20x slower in my test if
> multiple applications are accessing proc files. This patch doesn't go
> that far. Instead, just put more pressure to shrink proc/sysfs slabs.
> 
> Signed-off-by: Shaohua Li <shli@fb.com>
> ---
>  fs/kernfs/mount.c | 2 ++
>  fs/proc/inode.c   | 2 ++
>  2 files changed, 4 insertions(+)
> 
> diff --git a/fs/kernfs/mount.c b/fs/kernfs/mount.c
> index d5b149a..5b4e747 100644
> --- a/fs/kernfs/mount.c
> +++ b/fs/kernfs/mount.c
> @@ -161,6 +161,8 @@ static int kernfs_fill_super(struct super_block *sb, unsigned long magic)
>  	sb->s_xattr = kernfs_xattr_handlers;
>  	sb->s_time_gran = 1;
>  
> +	sb->s_shrink.seeks = 1;
> +	sb->s_shrink.batch = 0;

This sort of thing needs comments as to why they are being changed.
Otherwise the next person who comes along to do shrinker
modifications won't have a clue about why this magic exists.

Also, I don't think s_shrink.batch = 0 does what you think it does.
The superblock batch size default of 1024 is more efficient than
setting sb->s_shrink.batch = 0 as that makes the shrinker use
SHRINK_BATCH:

#define SHRINK_BATCH 128

i.e. it does less work per batch so has more overhead....

Cheers,

Dave.
-- 
Dave Chinner
david@fromorbit.com

      reply	other threads:[~2016-10-21 23:00 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-10-21 20:35 [RFC] put more pressure on proc/sysfs slab shrink Shaohua Li
2016-10-21 23:00 ` Dave Chinner [this message]

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=20161021230007.GV23194@dastard \
    --to=david@fromorbit.com \
    --cc=Kernel-team@fb.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=shli@fb.com \
    --cc=viro@zeniv.linux.org.uk \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.