lkml.org 
[lkml]   [2019]   [Jan]   [30]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] proc: calculate end pointer for /proc/*/* lookup at compile time
On Tue, Jan 29, 2019 at 02:18:48PM -0800, Andrew Morton wrote:
> On Mon, 14 Jan 2019 23:04:23 +0300 Alexey Dobriyan <adobriyan@gmail.com> wrote:
>
> > Compilers like to transform loops like
> >
> > for (i = 0; i < n; i++) {
> > [use p[i]]
> > }
> >
> > into
> > for (p = p0; p < end; p++) {
> > ...
> > }
> >
> > Do it by hand, so that it results in overall simpler loop
> > and smaller code.
> >
> > Space savings:
> >
> > $ ./scripts/bloat-o-meter ../vmlinux-001 ../obj/vmlinux
> > add/remove: 0/0 grow/shrink: 2/1 up/down: 4/-9 (-5)
> > Function old new delta
> > proc_tid_base_lookup 17 19 +2
> > proc_tgid_base_lookup 17 19 +2
> > proc_pident_lookup 179 170 -9
> >
> > Note: this trick bloats readdir, so don't do it :-\
>
> I don't understand the Note:. Can you please expand?

The same could be done to proc_pident_readdir(), but the code becomes
bigger for some reason.

\
 
 \ /
  Last update: 2019-01-30 06:55    [W:0.049 / U:2.324 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site