From: Andrew Morton <akpm@linux-foundation.org>
To: Gerald Schaefer <gerald.schaefer@de.ibm.com>
Cc: linux-kernel@vger.kernel.org, linux-s390@vger.kernel.org,
schwidefsky@de.ibm.com, mingo@elte.hu, davem@davemloft.net,
tony.luck@intel.com, paulus@samba.org, tglx@linutronix.de,
lethal@linux-sh.org
Subject: Re: [PATCH 2/3] hugetlbfs: add missing TLB flush to hugetlb_cow()
Date: Thu, 3 Apr 2008 14:49:13 -0700 [thread overview]
Message-ID: <20080403144913.4eb59540.akpm@linux-foundation.org> (raw)
In-Reply-To: <1207146546.4980.14.camel@localhost.localdomain>
On Wed, 02 Apr 2008 16:29:05 +0200
Gerald Schaefer <gerald.schaefer@de.ibm.com> wrote:
> Subject: [PATCH 2/3] hugetlbfs: add missing TLB flush to hugetlb_cow()
>
> From: Gerald Schaefer <gerald.schaefer@de.ibm.com>
>
> A cow break on a hugetlbfs page with page_count > 1 will set a new pte
> with set_huge_pte_at(), w/o any tlb flush operation. The old pte will
> remain in the tlb and subsequent write access to the page will result
> in a page fault loop, for as long as it may take until the tlb is
> flushed from somewhere else.
> This patch introduces an architecture-specific huge_ptep_clear_flush()
> function, which is called before the the set_huge_pte_at() in
> hugetlb_cow().
>
> NOTE: This is just a nop on all architectures for now, there will be an
> s390 implementation with our large page patch later. Other architectures
> should define their own huge_ptep_clear_flush() if needed.
>
> +#define huge_ptep_clear_flush(vma, addr, ptep) do { } while (0)
> +#define huge_ptep_clear_flush(vma, addr, ptep) do { } while (0)
> +#define huge_ptep_clear_flush(vma, addr, ptep) do { } while (0)
> +#define huge_ptep_clear_flush(vma, addr, ptep) do { } while (0)
> +#define huge_ptep_clear_flush(vma, addr, ptep) do { } while (0)
Again, the problem here is that the macro doesn't have typechecking so I
can merrily add
huge_ptep_clear_flush(some_u64, some_struct_ntfs_inode, some_undefined_variable)
and the compiler will just swallow it, depending on config options. An
inline solves this.
And the macro can lead to unused-variable warnings because the macro
doesn't count as a reference of its args. An inline solves this too.
There is almost never any need to put any code in macros ever. Please make
it a last resort, not a first one.
next prev parent reply other threads:[~2008-04-03 21:50 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-04-02 14:17 [PATCH 0/3] hugetlbfs: cleanup and new primitives for s390 Gerald Schaefer
2008-04-02 14:26 ` [PATCH 1/3] hugetlbfs: architecture header cleanup Gerald Schaefer
2008-04-02 17:42 ` Dave Hansen
2008-04-02 19:07 ` Heiko Carstens
2008-04-03 21:43 ` Andrew Morton
2008-04-02 14:29 ` [PATCH 2/3] hugetlbfs: add missing TLB flush to hugetlb_cow() Gerald Schaefer
2008-04-03 21:49 ` Andrew Morton [this message]
2008-04-02 14:38 ` [PATCH 3/3] hugetlbfs: common code update for s390 Gerald Schaefer
-- strict thread matches above, loose matches on Subject: below --
2008-04-04 16:45 [PATCH 0/3] hugetlbfs: cleanup and new primitives for s390, v3 Gerald Schaefer
2008-04-04 16:51 ` [PATCH 2/3] hugetlbfs: add missing TLB flush to hugetlb_cow() Gerald Schaefer
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=20080403144913.4eb59540.akpm@linux-foundation.org \
--to=akpm@linux-foundation.org \
--cc=davem@davemloft.net \
--cc=gerald.schaefer@de.ibm.com \
--cc=lethal@linux-sh.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-s390@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=paulus@samba.org \
--cc=schwidefsky@de.ibm.com \
--cc=tglx@linutronix.de \
--cc=tony.luck@intel.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