From 0030633355db2bba32d97655df73b04215018ab9 Mon Sep 17 00:00:00 2001 From: Alexander Viro Date: Sun, 21 Apr 2002 23:03:37 -0700 Subject: [PATCH] (3/5) sane procfs/dcache interaction - sane dentry retention. Namely, we don't kill /proc/ dentries at the first opportunity (as the current tree does). Instead we do the following: * ->d_delete() kills it only if process is already dead. * all ->lookup() in proc/base.c end with checking if process is still alive and unhash if it isn't. * proc_pid_lookup() (lookup for /proc/) caches reference to dentry in task_struct. It's _not_ counted in ->d_count. * ->d_iput() resets said reference to NULL. * release_task() (burying a zombie) checks if there is a cached reference and if there is - shrinks the subtree. * tasklist_lock is used for exclusion. That way we are guaranteed that after release_task() all dentries in /proc/ will go away as soon as possible; OTOH, before release_task() we have normal retention policy - they go away under memory pressure with the same rules as for dentries on any other fs. --- include/linux/sched.h | 1 + 1 file changed, 1 insertion(+) (limited to 'include/linux') diff --git a/include/linux/sched.h b/include/linux/sched.h index 8f0df64bb723..a65b376d99da 100644 --- a/include/linux/sched.h +++ b/include/linux/sched.h @@ -346,6 +346,7 @@ struct task_struct { /* journalling filesystem info */ void *journal_info; + struct dentry *proc_dentry; }; extern void __put_task_struct(struct task_struct *tsk); -- cgit v1.2.3