[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-Id: <20080403144913.4eb59540.akpm@linux-foundation.org>
Date: Thu, 3 Apr 2008 14:49:13 -0700
From: Andrew Morton <akpm@...ux-foundation.org>
To: Gerald Schaefer <gerald.schaefer@...ibm.com>
Cc: linux-kernel@...r.kernel.org, linux-s390@...r.kernel.org,
schwidefsky@...ibm.com, mingo@...e.hu, davem@...emloft.net,
tony.luck@...el.com, paulus@...ba.org, tglx@...utronix.de,
lethal@...ux-sh.org
Subject: Re: [PATCH 2/3] hugetlbfs: add missing TLB flush to hugetlb_cow()
On Wed, 02 Apr 2008 16:29:05 +0200
Gerald Schaefer <gerald.schaefer@...ibm.com> wrote:
> Subject: [PATCH 2/3] hugetlbfs: add missing TLB flush to hugetlb_cow()
>
> From: Gerald Schaefer <gerald.schaefer@...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.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists