Skip to content

Commit c9136fa

Browse files
osandovbrauner
authored andcommitted
proc/kcore: mark proc entry as permanent
drgn reads from /proc/kcore to debug the running kernel. For many drgn scripts, /proc/kcore is actually a bottleneck. use_pde() and unuse_pde() in prog_reg_read() show up hot in profiles. Since the entry for /proc/kcore can never be removed, this is useless overhead that can be trivially avoided by marking the entry as permanent. In my benchmark, this reduces the time per read by about 20 nanoseconds, from 235 nanoseconds per read to 215. Link: osandov/drgn#106 Signed-off-by: Omar Sandoval <[email protected]> Link: https://lore.kernel.org/r/60873e6afcfda3f08d0456f19e4733612afcf134.1731115587.git.osandov@fb.com Signed-off-by: Christian Brauner <[email protected]>
1 parent 40384c8 commit c9136fa

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

fs/proc/kcore.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -663,6 +663,7 @@ static int release_kcore(struct inode *inode, struct file *file)
663663
}
664664

665665
static const struct proc_ops kcore_proc_ops = {
666+
.proc_flags = PROC_ENTRY_PERMANENT,
666667
.proc_read_iter = read_kcore_iter,
667668
.proc_open = open_kcore,
668669
.proc_release = release_kcore,

0 commit comments

Comments
 (0)