From: Linus Torvalds <torvalds@linux-foundation.org>
To: Arjan van de Ven <arjan@infradead.org>
Cc: Cyrill Gorcunov <gorcunov@gmail.com>,
LKML <linux-kernel@vger.kernel.org>,
Andrew Morton <akpm@linux-foundation.org>,
Ingo Molnar <mingo@elte.hu>
Subject: Re: memset as memzero
Date: Sat, 22 Sep 2007 11:53:53 -0700 (PDT) [thread overview]
Message-ID: <alpine.LFD.0.999.0709221149480.16478@woody.linux-foundation.org> (raw)
In-Reply-To: <20070922124659.741cca42@laptopd505.fenrus.org>
On Sat, 22 Sep 2007, Arjan van de Ven wrote:
>
> it doesn't add value.... memset with a constant 0 is just as fast
> (since the compiler knows it's 0) than any wrapper around it, and the
> syntax around it is otherwise the same.
Indeed.
The reason we have "clear_page()" is not because the value we're writing
is constant - that doesn't really help/change anything at all. We could
have had a "fill_page()" that sets the value to any random byte, it's just
that zero is the only value that we really care about.
So the reason we have "clear_page()" is because the *size* and *alignment*
is constant and known at compile time, and unlike the value you write,
that actually matters.
So "memzero()" would never really make sense as anything but a syntactic
wrapper around "memset(x,0,size)".
Linus
next prev parent reply other threads:[~2007-09-22 18:59 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-09-22 8:33 Cyrill Gorcunov
2007-09-22 8:48 ` Robert P. J. Day
2007-09-22 9:35 ` Cyrill Gorcunov
2007-09-22 9:55 ` Robert P. J. Day
2007-09-22 10:15 ` Cyrill Gorcunov
2007-09-22 19:46 ` Arjan van de Ven
2007-09-22 18:53 ` Linus Torvalds [this message]
2007-09-23 15:32 ` Dave Jones
2007-09-23 16:07 ` Arnaldo Carvalho de Melo
2007-09-23 17:05 ` Linus Torvalds
2007-09-23 18:46 ` Willy Tarreau
2007-09-23 16:33 ` Robert P. J. Day
2007-09-23 16:46 ` Arnaldo Carvalho de Melo
2007-09-22 19:25 ` Bernd Eckenfels
2007-09-22 20:37 ` Oleg Verych (nntp)
2007-09-22 19:32 ` Cyrill Gorcunov
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=alpine.LFD.0.999.0709221149480.16478@woody.linux-foundation.org \
--to=torvalds@linux-foundation.org \
--cc=akpm@linux-foundation.org \
--cc=arjan@infradead.org \
--cc=gorcunov@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
/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®