linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Alexey Dobriyan <adobriyan@gmail.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: linux-kernel@vger.kernel.org
Subject: Re: [PATCH] proc: calculate end pointer for /proc/*/* lookup at compile time
Date: Wed, 30 Jan 2019 08:55:01 +0300	[thread overview]
Message-ID: <20190130055501.GA2115@avx2> (raw)
In-Reply-To: <20190129141848.5f3d2d1aa125c8ec45ee091d@linux-foundation.org>

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.

      reply	other threads:[~2019-01-30  5:55 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-01-14 20:04 [PATCH] proc: calculate end pointer for /proc/*/* lookup at compile time Alexey Dobriyan
2019-01-29 22:18 ` Andrew Morton
2019-01-30  5:55   ` Alexey Dobriyan [this message]

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=20190130055501.GA2115@avx2 \
    --to=adobriyan@gmail.com \
    --cc=akpm@linux-foundation.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).