[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1167586995.20929.829.camel@laptopd505.fenrus.org>
Date: Sun, 31 Dec 2006 18:43:15 +0100
From: Arjan van de Ven <arjan@...radead.org>
To: "Robert P. J. Day" <rpjday@...dspring.com>
Cc: Folkert van Heusden <folkert@...heusden.com>,
Denis Vlasenko <vda.linux@...glemail.com>,
Linux kernel mailing list <linux-kernel@...r.kernel.org>
Subject: Re: replace "memset(...,0,PAGE_SIZE)" calls with "clear_page()"?
> arjan, you and i actually agree on this. i fully accept that the idea
> of a "clear_page()" call might or should have extra semantics,
> compared to the more simple and direct "memset(...,0,PAGE_SIZE)" call
> (such as alignment requirements, for example). my observation is
> simply that this is not what is currently happening.
that's fair
>
> consider, for example, how many calls there are to clear_page() in the
> drivers directory:
>
> $ grep -rw clear_page drivers
>
> not that many.
the biggest user of clear_page and such is the pagefault code path in
practice.
> i can't believe that at least *some* of those memset() calls couldn't
> be re-written as clear_page() calls. and that's just for the
> drivers/ directory.
yes I can believe that ....
>
> sure, clear_page() might have extra semantics. but if that's the
> case, and those semantics happen to be in play, i'm suggesting that
> not only *can* one use clear_page() at that point, one *should* use
> it.
>
> put another way, if a given situation is appropriate for a call to
> clear_page(), then that's what should be used.
.... however there is potentially a bigger thing possible.
These places that zero a whole full page may have just allocated it
(that's an assumption on my side), and if that's the case, maybe those
places instead should use the zeroing version of the allocator instead
(which internally uses clear_page() ).
So... yes I fully agree with you that it's worth looking at the
memset( , PAGE_SIZE) users. If they are page aligned, yes absolutely
make it a clear_page(), I think that's a very good idea. However also
please check if they've been very recently allocated in that code, and
if maybe the zeroing allocators are better suited there..
(or maybe there's even double zeroing going on.. that's be a nice gain)
--
if you want to mail me at work (you don't), use arjan (at) linux.intel.com
Test the interaction between Linux and your BIOS via http://www.linuxfirmwarekit.org
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists