linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: ebiederm@xmission.com (Eric W. Biederman)
To: Andrew Morton <akpm@osdl.org>
Cc: linux-kernel@vger.kernel.org
Subject: Re: [PATCH 00/23] proc cleanup.
Date: Sat, 25 Feb 2006 08:20:32 -0700	[thread overview]
Message-ID: <m13bi731of.fsf@ebiederm.dsl.xmission.com> (raw)
In-Reply-To: <20060225042757.1442ee2c.akpm@osdl.org> (Andrew Morton's message of "Sat, 25 Feb 2006 04:27:57 -0800")

Andrew Morton <akpm@osdl.org> writes:

> ebiederm@xmission.com (Eric W. Biederman) wrote:
>>
>> When working on pid namespaces I keep tripping over /proc.
>>  It's hard coded inode numbers and the amount of cruft
>>  accumulated over the years makes it hard to deal with.
>> 
>>  So to put /proc out of my misery here is a series of patches that
>>  removes the worst of the warts.
>
> An additional 2.7k of vmlinux.  A shame.

Looks like that at least is compiler dependent, with gcc-3.3.5 I get:

   text    data     bss     dec     hex filename
2601428  502342  226092 3329862  32cf46 ../linux-2.6-ns-mirror-build1/vmlinux
2602548  502494  226092 3331134  32d43e ../linux-2.6-ns-mirror-build2/vmlinux

So it looks like 1K of test and about 100 bytes of data.

Investigating this quickly.  Because of the refactoring it
is hard to pin this down to any major culprit.  But that is
also good news in that it doesn't look like an inline function
is responsible for this growth :)

It looks like the culprit for small amounts of growth is
the work to see if a task still exists, and other similar
checks that were needed but missing.

For the big chunks it looks like the work to populate the
dcache during readdir, which keeps the inode numbers in
sync and should help readdir+stat performance.

The other big culprit is proc_flush_task which is both
more comprehensive and simpler that proc_pid_flush+proc_pid_unhash=107+28.
But unfortunately that has made it a lot bigger.

So short of getting better dcache helpers for the case
where readdir populates the dcache it doesn't look the code
size will come down much.

The one practical thing that will help a little is that it
looks like with just a little more work we can replace
all of read_lock(&tasklist_lock) with rcu_read_lock().

add/remove: 33/23 grow/shrink: 28/16 up/down: 4968/-3619 (1349)
function                                     old     new   delta
proc_flush_task                                -     605    +605
proc_check_dentry_visible                      -     325    +325
proc_fill_cache                                -     256    +256
proc_fd_instantiate                            -     243    +243
tref_get_by_task                               -     200    +200
first_tid                                      -     179    +179
tgid_base_stuff                              336     504    +168
tid_base_stuff                               320     480    +160
first_tgid                                     -     159    +159
proc_pident_instantiate                        -     158    +158
proc_task_instantiate                          -     128    +128
proc_pid_instantiate                           -     128    +128
attr_dir_stuff                                 -     120    +120
proc_attr_dir_operations                       -     108    +108
tref_get_by_pid                                -     107    +107
proc_task_getattr                              -     105    +105
next_tid                                       -     100    +100
next_tgid                                      -      89     +89
tref_put                                       -      87     +87
proc_attr_dir_inode_operations                 -      84     +84
do_maps_open                                   -      80     +80
proc_fd_fill_cache                             -      63     +63
proc_task_fill_cache                           -      60     +60
proc_pid_fill_cache                            -      60     +60
__detach_pid                                 136     195     +59
proc_info_read                               111     164     +53
oom_adjust_read                              162     215     +53
proc_get_sb                                   26      78     +52
seccomp_write                                168     218     +50
seccomp_read                                 164     214     +50
oom_adjust_write                             164     214     +50
proc_pid_attr_read                           124     172     +48
proc_base_stuff                                -      48     +48
proc_pid_attr_write                          148     194     +46
proc_fd_link                                 122     168     +46
proc_exe_link                                152     198     +46
mounts_open                                  157     200     +43
proc_root_link                                99     141     +42
proc_cwd_link                                 99     141     +42
tid_fd_revalidate                            207     247     +40
proc_pident_fill_cache                         -      40     +40
get_tref_task                                  -      33     +33
dup_task_struct                              137     170     +33
m_stop                                        59      88     +29
m_start                                      235     264     +29
tref_reset                                     -      28     +28
proc_attr_dir_readdir                          -      28     +28
proc_pident_readdir                          270     296     +26
proc_attr_dir_lookup                           -      22     +22
tref_set                                       -      21     +21
tref_fini                                      -      21     +21
tref_init                                      -      18     +18
proc_pid_follow_link                          98     116     +18
init_tref                                      -      16     +16
init_task                                   1328    1344     +16
pid_revalidate                               178     192     +14
attach_pid                                   149     162     +13
tref_get                                       -       8      +8
mem_read                                     430     438      +8
proc_alloc_inode                              98     102      +4
proc_task_readdir                            320     323      +3
pid_delete_dentry                             24      21      -3
m_next                                        70      61      -9
proc_readfd                                  327     307     -20
copy_process                                3190    3170     -20
smaps_open                                    43      22     -21
maps_open                                     43      22     -21
proc_tid_attr_lookup                          22       -     -22
proc_tgid_attr_lookup                         22       -     -22
proc_delete_inode                            129     105     -24
pid_base_dentry_operations                    24       -     -24
proc_tid_attr_readdir                         28       -     -28
proc_tgid_attr_readdir                        28       -     -28
proc_pid_flush                                28       -     -28
release_task                                 257     228     -29
proc_permission                               38       -     -38
proc_pid_make_inode                          205     166     -39
unhash_process                                73      33     -40
de_thread                                   1310    1266     -44
proc_check_root                               55       -     -55
proc_task_lookup                             244     188     -56
pid_base_iput                                 62       -     -62
proc_pid_readdir                             303     229     -74
tid_attr_stuff                                80       -     -80
tgid_attr_stuff                               80       -     -80
proc_task_permission                          82       -     -82
proc_tid_attr_inode_operations                84       -     -84
proc_tgid_attr_inode_operations               84       -     -84
proc_mem_inode_operations                     84       -     -84
get_tid_list                                  97       -     -97
proc_pid_unhash                              107       -    -107
proc_tid_attr_operations                     108       -    -108
proc_tgid_attr_operations                    108       -    -108
proc_lookupfd                                240      99    -141
get_tgid_list                                146       -    -146
proc_task_root_link                          218       -    -218
proc_check_chroot                            245       -    -245
switch_exec_pids                             290       -    -290
proc_pid_lookup                              503     145    -358
proc_pident_lookup                           742     142    -600

Eric

  parent reply	other threads:[~2006-02-25 15:21 UTC|newest]

Thread overview: 49+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-02-23 15:52 [PATCH 00/23] proc cleanup Eric W. Biederman
2006-02-23 15:54 ` [PATCH 01/23] tref: Implement task references Eric W. Biederman
2006-02-23 15:56   ` [PATCH 02/23] proc: Fix the .. inode number on /proc/<pid>/fd Eric W. Biederman
2006-02-23 15:57     ` [PATCH 03/23] proc: Remove useless BKL in proc_pid_readlink Eric W. Biederman
2006-02-23 15:58       ` [PATCH 04/23] proc: Remove unnecessary and misleading assignments from proc_pid_make_inode Eric W. Biederman
2006-02-23 16:00         ` [PATCH 05/23] proc: Simplify the ownership rules for /proc Eric W. Biederman
2006-02-23 16:02           ` Eric W. Biederman
2006-02-23 16:04           ` [PATCH 06/23] proc: Replace proc_inode.type with proc_inode.fd Eric W. Biederman
2006-02-23 16:05             ` [PATCH 07/23] proc: Remove bogus proc_task_permission Eric W. Biederman
2006-02-23 16:06               ` [PATCH 08/23] proc: Kill proc_mem_inode_operations Eric W. Biederman
2006-02-23 16:08                 ` [PATCH 09/23] proc: Properly filter out files that are not visible to a process Eric W. Biederman
2006-02-23 16:10                   ` [PATCH 10/23] proc: Fix the link count for /proc/<pid>/task Eric W. Biederman
2006-02-23 16:12                     ` [PATCH 11/23] proc: Move proc_maps_operations into task_mmu.c Eric W. Biederman
2006-02-23 16:15                       ` [PATCH 12/23] proc: Rewrite the proc dentry flush on exit optimization Eric W. Biederman
2006-02-23 16:16                         ` [PATCH 13/23] proc: Close the race of a process dying durning lookup Eric W. Biederman
2006-02-23 16:18                           ` [PATCH 14/23] proc: Make PROC_NUMBUF the buffer size for holding a integers as strings Eric W. Biederman
2006-02-23 16:20                             ` [PATCH 15/23] proc: refactor reading directories of tasks Eric W. Biederman
2006-02-23 16:23                               ` [PATCH 16/23] proc: Don't lock task_structs indefinitely Eric W. Biederman
2006-02-23 16:24                                 ` [PATCH 17/23] proc: Give the root directory a task Eric W. Biederman
2006-02-23 16:25                                   ` [PATCH 18/23] proc: Reorder the functions in base.c Eric W. Biederman
2006-02-23 16:27                                     ` [PATCH 19/23] proc: Modify proc_pident_lookup to be completely table driven Eric W. Biederman
2006-02-23 16:28                                       ` [PATCH 20/23] proc: Make the generation of the self symlink " Eric W. Biederman
2006-02-23 16:30                                         ` [PATCH 21/23] proc: Factor out an instantiate method from every lookup method Eric W. Biederman
2006-02-23 16:32                                           ` [PATCH 22/23] proc: Remove the hard coded inode numbers Eric W. Biederman
2006-02-23 16:34                                             ` [PATCH 23/23] proc: Merge proc_tid_attr and proc_tgid_attr Eric W. Biederman
2006-02-23 16:49   ` [PATCH 01/23] tref: Implement task references Eric W. Biederman
2006-03-02 19:16     ` Oleg Nesterov
2006-03-02 20:37       ` Oleg Nesterov
2006-03-02 22:19       ` Eric W. Biederman
2006-03-03 16:56         ` Oleg Nesterov
2006-03-03 17:48           ` Eric W. Biederman
2006-03-04 11:16           ` Eric W. Biederman
2006-03-04 12:31             ` Oleg Nesterov
2006-03-04 17:30               ` Oleg Nesterov
2006-03-06 21:06         ` Oleg Nesterov
2006-03-06 22:18           ` Eric W. Biederman
2006-03-07 20:44             ` Oleg Nesterov
2006-03-07  1:39           ` Eric W. Biederman
2006-03-07 20:38             ` Oleg Nesterov
2006-03-07 13:12           ` Eric W. Biederman
2006-03-07 21:02             ` Oleg Nesterov
2006-03-07 23:00               ` Eric W. Biederman
2006-03-03 19:23     ` Oleg Nesterov
2006-03-04 10:51       ` Eric W. Biederman
2006-02-25 12:27 ` [PATCH 00/23] proc cleanup Andrew Morton
2006-02-25 13:34   ` Eric W. Biederman
2006-02-25 15:20   ` Eric W. Biederman [this message]
2006-02-27 15:26 ` Serge E. Hallyn
2006-02-27 15:56   ` Eric W. Biederman

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=m13bi731of.fsf@ebiederm.dsl.xmission.com \
    --to=ebiederm@xmission.com \
    --cc=akpm@osdl.org \
    --cc=linux-kernel@vger.kernel.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).