lkml.org 
[lkml]   [2020]   [Aug]   [30]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v2 1/2] mm/pageblock: mitigation cmpxchg false sharing in pageblock flags
On Sun, Aug 30, 2020 at 06:14:33PM +0800, Alex Shi wrote:
> +++ b/mm/page_alloc.c
> @@ -532,9 +536,18 @@ void set_pfnblock_flags_mask(struct page *page, unsigned long flags,
> mask <<= bitidx;
> flags <<= bitidx;
>
> +#ifdef CONFIG_CPU_V6
> + byte = (unsigned long)READ_ONCE(bitmap[byte_bitidx]);
> +#else
> byte = READ_ONCE(bitmap[byte_bitidx]);
> +#endif
> for (;;) {
> +#ifdef CONFIG_CPU_V6
> + /* arm v6 has no cmpxchgb function, so still false sharing long word */
> + old_byte = cmpxchg((unsigned long*)&bitmap[byte_bitidx], byte, (byte & ~mask) | flags);
> +#else
> old_byte = cmpxchg(&bitmap[byte_bitidx], byte, (byte & ~mask) | flags);
> +#endif

Good grief, no. Either come up with an appropriate abstraction or
abandon this patch. We can't possibly put this kind of ifdef in the
memory allocator!

\
 
 \ /
  Last update: 2020-08-30 12:18    [W:0.079 / U:1.312 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site