From: Linus Torvalds <torvalds@linux-foundation.org>
To: James Bottomley <James.Bottomley@HansenPartnership.com>
Cc: Andrea Righi <righi.andrea@gmail.com>,
akpm@linux-foundation.org, linux-mm@kvack.org,
linux-arch@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/1] mm: unify pmd_free() implementation
Date: Mon, 28 Jul 2008 10:10:19 -0700 (PDT) [thread overview]
Message-ID: <alpine.LFD.1.10.0807281000070.3486@nehalem.linux-foundation.org> (raw)
In-Reply-To: <1217264339.3503.97.camel@localhost.localdomain>
On Mon, 28 Jul 2008, James Bottomley wrote:
>
> Sorry ... should have been clearer. My main concern is the cost of
> barrier() which is just a memory clobber ... we have to use barriers to
> place the probe points correctly in the code.
Oh, "barrier()" itself has _much_ less cost.
It still has all the "needs to flush any global/address-taken-of variables
to memory" property and can thus cause reloads, but that's kind of the
point of it, after all. So in that sense "barrier()" is free: the only
cost of a barrier is the cost of what you actually need to get done. It's
not really "free", but it's also not any more costly than what your
objective was.
In contrast, the "objective" in an empty function call is seldom the
serialization, so in that case the serialization is all just unnecessary
overhead.
Also, barrier() avoids the big hit of turning a leaf function into a
non-leaf one. It also avoids all the fixed registers and the register
clobbers (although for tracing purposes you may end up setting up fixed
regs, of course).
The leaf -> non-leaf thing is actually often the major thing. Yes, the
compiler will often inline functions that are simple enough to be leaf
functions with no stack frame, so we don't have _that_ many of them, but
when it hits, it's often the most noticeable part of an unnecessary
function call. And "barrier()" should never trigger that problem.
Linus
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
next prev parent reply other threads:[~2008-07-28 17:10 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-07-28 15:51 Andrea Righi
2008-07-28 15:53 ` Linus Torvalds
2008-07-28 16:17 ` Andrea Righi
2008-07-28 16:27 ` KOSAKI Motohiro
2008-07-28 17:19 ` Andrea Righi
2008-07-28 20:30 ` Andrew Morton
2008-07-28 20:46 ` Jeremy Fitzhardinge
2008-07-28 22:53 ` [PATCH 1/1] mm: unify pmd_free() and __pmd_free_tlb() implementation Andrea Righi
2008-07-31 16:17 ` Ingo Molnar
2008-07-31 16:59 ` Andrea Righi
2008-07-28 16:17 ` [PATCH 1/1] mm: unify pmd_free() implementation James Bottomley
2008-07-28 16:45 ` Linus Torvalds
2008-07-28 16:58 ` James Bottomley
2008-07-28 17:10 ` Linus Torvalds [this message]
2008-07-28 20:08 ` [PATCH 1/1] mm: unify pmd_free() implementation -> instrumentation Mathieu Desnoyers
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.1.10.0807281000070.3486@nehalem.linux-foundation.org \
--to=torvalds@linux-foundation.org \
--cc=James.Bottomley@HansenPartnership.com \
--cc=akpm@linux-foundation.org \
--cc=linux-arch@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=righi.andrea@gmail.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