[PATCH RFC 5/6] dcache: push releasing dentry lock into sweep_negative

2021-01-21 Thread Gautham Ananthakrishna
From: Konstantin Khlebnikov Release the dentry lock inside the sweep_negative() function. This is in preparation for a follow up patch and doesn't change runtime behavior. Signed-off-by: Konstantin Khlebnikov Signed-off-by: Gautham Ananthakrisha --- fs/dcache.c | 8 ++-- 1 file changed,

[PATCH RFC 4/6] dcache: stop walking siblings if remaining dentries all negative

2021-01-21 Thread Gautham Ananthakrishna
From: Konstantin Khlebnikov Most walkers are interested only in positive dentries. Changes in simple_* libfs helpers are mostly cosmetic: it shouldn't cache negative dentries unless uses d_delete other than always_delete_dentry(). Signed-off-by: Konstantin Khlebnikov Signed-off-by: Ga

[PATCH RFC 3/6] dcache: add action D_WALK_SKIP_SIBLINGS to d_walk()

2021-01-21 Thread Gautham Ananthakrishna
From: Konstantin Khlebnikov This lets skip remaining siblings at seeing d_is_tail_negative(). Signed-off-by: Konstantin Khlebnikov Signed-off-by: Gautham Ananthakrishna --- fs/dcache.c | 7 +++ 1 file changed, 7 insertions(+) diff --git a/fs/dcache.c b/fs/dcache.c index a506169..894e6da

[PATCH RFC 6/6] dcache: prevent flooding with negative dentries

2021-01-21 Thread Gautham Ananthakrishna
522699.9% nr_negative = 24600351 99.9% This heuristic isn't bulletproof and solves only most practical case. It's easy to deceive: just touch same random name twice. Signed-off-by: Konstantin Khlebnikov Signed-off-by: Gautham An

[PATCH RFC 2/6] fsnotify: stop walking child dentries if remaining tail is negative

2021-01-21 Thread Gautham Ananthakrishna
99.9% nr_negative = 24543867 99.9% inotify time: 0.10 seconds Negative dentries no longer slow down inotify op at parent directory. Signed-off-by: Konstantin Khlebnikov Signed-off-by: Gautham Ananthakrishna --- fs/notify/fsnotify.c | 6 +- 1 file changed, 5 insertions(+), 1

[PATCH RFC 0/6] fix the negative dentres bloating system memory usage

2021-01-21 Thread Gautham Ananthakrishna
For most filesystems result of every negative lookup is cached, content of directories is usually cached too. Production of negative dentries isn't limited with disk speed. It's really easy to generate millions of them if system has enough memory. Getting this memory back ins't that easy because s

[PATCH RFC 1/6] dcache: sweep cached negative dentries to the end of list of siblings

2021-01-21 Thread Gautham Ananthakrishna
following dentries are negative too. Reverse operation is required before instantiating negative dentry. Signed-off-by: Konstantin Khlebnikov Signed-off-by: Gautham Ananthakrishna --- fs/dcache.c| 59 +++--- include/linux/dcache.h | 6