lkml.org 
[lkml]   [2008]   [Apr]   [3]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 2/3] hugetlbfs: add missing TLB flush to hugetlb_cow()
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.



\
 
 \ /
  Last update: 2008-04-03 23:53    [W:1.059 / U:0.076 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site