lists.openwall.net | lists / announce owl-users owl-dev john-users john-dev passwdqc-users yescrypt popa3d-users / oss-security kernel-hardening musl sabotage tlsify passwords / crypt-dev xvendor / Bugtraq Full-Disclosure linux-kernel linux-netdev linux-ext4 linux-hardening PHC | |
Open Source and information security mailing list archives
| ||
|
Date: Mon, 18 Sep 2017 14:20:33 -0400 From: Waiman Long <longman@...hat.com> To: Alexander Viro <viro@...iv.linux.org.uk> Cc: linux-kernel@...r.kernel.org, linux-fsdevel@...r.kernel.org, Linus Torvalds <torvalds@...ux-foundation.org>, Jan Kara <jack@...e.cz>, "Paul E. McKenney" <paulmck@...ux.vnet.ibm.com>, Andrew Morton <akpm@...ux-foundation.org>, Ingo Molnar <mingo@...nel.org>, Miklos Szeredi <mszeredi@...hat.com>, Matthew Wilcox <willy@...radead.org>, Larry Woodman <lwoodman@...hat.com>, James Bottomley <James.Bottomley@...senPartnership.com>, "Wangkai (Kevin C)" <wangkai86@...wei.com>, Waiman Long <longman@...hat.com> Subject: [PATCH v4 5/6] fs/dcache: Track count of negative dentries forcibly killed There is performance concern about killing recently created negative dentries. This should rarely happen under normal working condition. To understand the extent of how often this negative dentry killing is happening, the /proc/sys/fs/denty-state file is extended to track this number. This allows us to see if additional measures will be needed to reduce the chance of negative dentries killing. Signed-off-by: Waiman Long <longman@...hat.com> --- fs/dcache.c | 4 ++++ include/linux/dcache.h | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/fs/dcache.c b/fs/dcache.c index dd1adda..f46603e 100644 --- a/fs/dcache.c +++ b/fs/dcache.c @@ -162,6 +162,7 @@ struct dentry_stat_t dentry_stat = { long n_pos; /* # of positive dentries pruned */ long nfree; /* Negative dentry free pool */ struct super_block *prune_sb; /* Super_block for pruning */ + atomic_long_t nr_neg_killed; /* # of negative entries killed */ } ndblk ____cacheline_aligned_in_smp; static void prune_negative_dentry(struct work_struct *work); @@ -220,6 +221,7 @@ int proc_nr_dentry(struct ctl_table *table, int write, void __user *buffer, dentry_stat.nr_dentry = get_nr_dentry(); dentry_stat.nr_unused = get_nr_dentry_unused(); dentry_stat.nr_negative = get_nr_dentry_neg(); + dentry_stat.nr_killed = atomic_long_read(&ndblk.nr_neg_killed); return proc_doulongvec_minmax(table, write, buffer, lenp, ppos); } #endif @@ -812,6 +814,7 @@ static struct dentry *dentry_kill(struct dentry *dentry) spin_unlock(&parent->d_lock); goto failed; } + atomic_long_inc(&ndblk.nr_neg_killed); } else if (unlikely(!spin_trylock(&parent->d_lock))) { if (inode) @@ -3907,6 +3910,7 @@ static void __init neg_dentry_init(void) unsigned long cnt; raw_spin_lock_init(&ndblk.nfree_lock); + atomic_long_set(&ndblk.nr_neg_killed, 0); /* 20% in global pool & 80% in percpu free */ ndblk.nfree = neg_dentry_nfree_init diff --git a/include/linux/dcache.h b/include/linux/dcache.h index 9052522..16d0244 100644 --- a/include/linux/dcache.h +++ b/include/linux/dcache.h @@ -66,7 +66,7 @@ struct dentry_stat_t { long age_limit; /* age in seconds */ long want_pages; /* pages requested by system */ long nr_negative; /* # of negative dentries */ - long dummy; + long nr_killed; /* # of negative dentries killed */ }; extern struct dentry_stat_t dentry_stat; -- 1.8.3.1
Powered by blists - more mailing lists