Re: [PATCH 2/3] hugetlbfs: add missing TLB flush to hugetlb_cow()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, 02 Apr 2008 16:29:05 +0200
Gerald Schaefer <gerald.schaefer@xxxxxxxxxx> wrote:

> Subject: [PATCH 2/3] hugetlbfs: add missing TLB flush to hugetlb_cow()
> 
> From: Gerald Schaefer <gerald.schaefer@xxxxxxxxxx>
> 
> 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-s390" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Kernel Development]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite Info]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Linux Media]     [Device Mapper]

  Powered by Linux