mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Arjan van de Ven <arjan@infradead.org>
To: "Robert P. J. Day" <rpjday@mindspring.com>
Cc: Folkert van Heusden <folkert@vanheusden.com>,
	Denis Vlasenko <vda.linux@googlemail.com>,
	Linux kernel mailing list <linux-kernel@vger.kernel.org>
Subject: Re: replace "memset(...,0,PAGE_SIZE)" calls with "clear_page()"?
Date: Sun, 31 Dec 2006 18:43:15 +0100	[thread overview]
Message-ID: <1167586995.20929.829.camel@laptopd505.fenrus.org> (raw)
In-Reply-To: <Pine.LNX.4.64.0612311118490.13153@localhost.localdomain>


> 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


  reply	other threads:[~2006-12-31 17:43 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-12-29  6:16 Robert P. J. Day
2006-12-30 20:49 ` Denis Vlasenko
2006-12-30 22:08   ` Robert P. J. Day
2006-12-30 22:40     ` Denis Vlasenko
2007-01-03  6:23       ` dean gaudet
2006-12-30 22:45     ` Arjan van de Ven
2006-12-30 23:04       ` Robert P. J. Day
2006-12-31 18:39         ` Paul Mundt
2006-12-31 19:04           ` Robert P. J. Day
2007-01-01  1:59             ` Folkert van Heusden
2007-01-01  8:33               ` Robert P. J. Day
2007-01-01 10:14                 ` Arjan van de Ven
2007-01-01 10:27                   ` Robert P. J. Day
2007-01-01 19:05                     ` Dave Jones
2007-01-01  8:42               ` Paul Mundt
2007-01-01 17:09                 ` Randy Dunlap
2006-12-31 13:39       ` Folkert van Heusden
2006-12-31 13:45         ` Arjan van de Ven
2006-12-31 16:39           ` Robert P. J. Day
2006-12-31 17:43             ` Arjan van de Ven [this message]
2007-01-03 13:20               ` Robert P. J. Day

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=1167586995.20929.829.camel@laptopd505.fenrus.org \
    --to=arjan@infradead.org \
    --cc=folkert@vanheusden.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rpjday@mindspring.com \
    --cc=vda.linux@googlemail.com \
    /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

all inboxes | Powered by JetHome®