public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Nick Piggin <nickpiggin@yahoo.com.au>
To: Hugh Dickins <hugh@veritas.com>
Cc: Andi Kleen <ak@suse.de>, "David S. Miller" <davem@davemloft.net>,
	benh@kernel.crashing.org, torvalds@osdl.org, akpm@osdl.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2/2] page table iterators
Date: Tue, 22 Feb 2005 20:54:43 +1100	[thread overview]
Message-ID: <421B0163.3050802@yahoo.com.au> (raw)
In-Reply-To: <Pine.LNX.4.61.0502210619290.7925@goblin.wat.veritas.com>

Hugh Dickins wrote:
> On Sun, 20 Feb 2005, Nick Piggin wrote:

>>
>>>Open coding is probably the smaller evil.
>>>And they're really not changed that often.
> 
> 
> My opinion FWIW: I'm all for regularizing the pagetable loops to
> work the same way, changing their variables to use the same names,
> improving their efficiency; but I do like to see what a loop is up to.
> 
> list_for_each and friends are very widely used, they're fine, and I'm
> quite glad to have their prefetching hidden away from me; but usually
> I groan, grin and bear it, each time someone devises a clever new
> for_each macro concealing half the details of some specialist loop.
> 
> In a minority?

OK, I think Andrew is now sitting on the fence after seeing the
code. So you (and Andi?) are the ones with remaining reservations
about this.

I don't disagree with your stance entirely, Hugh. I think these
macros are close to being too complicated... But I don't think
they is hiding too much detail: we all know that conceptually,
walking a page table page is reasonably simple. There are just a
few tricky bits like wrapping and termination that caused such
a divergent range of implementations - I would argue that hiding
these details is OK, because they are basically inconsequencial
to the job at hand. I think that actually makes the high level
intention of the code clearer, if anything.

If you are reading just the patch, that doesn't quite do it
justice IMO - in that case, have a look at the code after the
patch is applied (I can send you one which applies to current
kernels if you'd like).

Also, the implementation of the macros is not insanely difficult
to understand, so the details are still accessible.

Lastly, they fold to 2 and 3 levels easily, which is something
that couldn't sanely be done with the open-coded implementation.
I think with an infinitely smart compiler, there shouldn't need
to be any folding here. But in practice I see quite a large
speedup, which is something we shouldn't ignore.

I do think that they are probably not ideal candidates for a
more general abstraction that would allow for example the
transparent drop in of Dave's bitmap walking functions (it
would be possible, but would not be pretty AFAIKS). I have some
other ideas to work towards those goals, but before that I
think these macros do help with the deficiencies of the current
situation.

Nick


  parent reply	other threads:[~2005-02-22  9:55 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-02-17 13:53 [PATCH 1/2] optimise copy page range Nick Piggin
2005-02-17 14:03 ` [PATCH 2/2] page table iterators Nick Piggin
2005-02-17 15:56   ` Linus Torvalds
2005-02-17 16:13     ` Nick Piggin
2005-02-17 19:43   ` Andi Kleen
2005-02-17 22:49     ` Benjamin Herrenschmidt
2005-02-17 23:03       ` Andi Kleen
2005-02-17 23:21         ` Benjamin Herrenschmidt
2005-02-17 23:34           ` Andi Kleen
2005-02-17 23:30         ` David S. Miller
2005-02-17 23:57           ` Andi Kleen
2005-02-20 12:35             ` Nick Piggin
2005-02-21  6:35               ` Hugh Dickins
2005-02-21  6:40                 ` Andrew Morton
2005-02-21  7:09                   ` Benjamin Herrenschmidt
2005-02-21  8:09                     ` Nick Piggin
2005-02-21  9:04                       ` Nick Piggin
2005-02-22  9:54                 ` Nick Piggin [this message]
2005-02-23  2:06                   ` Hugh Dickins
2005-02-23  4:31                     ` David S. Miller
2005-02-23  4:49                       ` Nick Piggin
2005-02-23  4:57                         ` David S. Miller
2005-02-23  5:23                       ` Nick Piggin
2005-02-23 23:52                     ` Nick Piggin
2005-02-24  0:00                       ` David S. Miller
2005-02-24  5:12                       ` Hugh Dickins
2005-02-24  5:59                         ` Nick Piggin
2005-02-24 11:58                           ` Hugh Dickins
2005-02-24 19:33                             ` David S. Miller
2005-02-25 10:44                               ` Andi Kleen
2005-02-24 21:59                             ` Nick Piggin
2005-02-24 22:32                               ` Hugh Dickins
2005-02-24 22:52                                 ` Nick Piggin

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=421B0163.3050802@yahoo.com.au \
    --to=nickpiggin@yahoo.com.au \
    --cc=ak@suse.de \
    --cc=akpm@osdl.org \
    --cc=benh@kernel.crashing.org \
    --cc=davem@davemloft.net \
    --cc=hugh@veritas.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=torvalds@osdl.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