> 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 [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
- References:
- replace "memset(...,0,PAGE_SIZE)" calls with "clear_page()"?
- Re: replace "memset(...,0,PAGE_SIZE)" calls with "clear_page()"?
- Re: replace "memset(...,0,PAGE_SIZE)" calls with "clear_page()"?
- Re: replace "memset(...,0,PAGE_SIZE)" calls with "clear_page()"?
- Re: replace "memset(...,0,PAGE_SIZE)" calls with "clear_page()"?
- Re: replace "memset(...,0,PAGE_SIZE)" calls with "clear_page()"?
- Re: replace "memset(...,0,PAGE_SIZE)" calls with "clear_page()"?
[Index of Archives]
[Kernel Newbies]
[Netfilter]
[Bugtraq]
[Photo]
[Stuff]
[Gimp]
[Yosemite News]
[MIPS Linux]
[ARM Linux]
[Linux Security]
[Linux RAID]
[Video 4 Linux]
[Linux for the blind]
[Linux Resources]