linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Matthew Wilcox <willy@infradead.org>
To: Alex Shi <alex.shi@linux.alibaba.com>
Cc: Anshuman Khandual <anshuman.khandual@arm.com>,
	David Hildenbrand <david@redhat.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	Hugh Dickins <hughd@google.com>,
	Alexander Duyck <alexander.h.duyck@linux.intel.com>,
	linux-mm@kvack.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 1/2] mm/pageblock: mitigation cmpxchg false sharing in pageblock flags
Date: Sun, 30 Aug 2020 11:18:23 +0100	[thread overview]
Message-ID: <20200830101823.GY14765@casper.infradead.org> (raw)
In-Reply-To: <01c846d4-2fe4-eeef-6c79-e71fda1f9a39@linux.alibaba.com>

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!



  reply	other threads:[~2020-08-30 10:18 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-19  5:47 Alex Shi
2020-08-19  5:47 ` [PATCH v2 2/2] mm/pageblock: remove false sharing in pageblock_flags Alex Shi
2020-08-19  7:57   ` Anshuman Khandual
2020-08-19  8:09     ` Alex Shi
2020-08-19  8:13       ` David Hildenbrand
2020-08-19  8:36         ` Alex Shi
2020-08-19 16:50       ` Alexander Duyck
2020-08-30 10:00         ` Alex Shi
2020-08-30 20:32           ` Alexander Duyck
2020-09-03  5:35             ` Alex Shi
2020-09-01 17:04       ` Vlastimil Babka
2020-08-19  7:55 ` [PATCH v2 1/2] mm/pageblock: mitigation cmpxchg false sharing in pageblock flags Anshuman Khandual
2020-08-19  8:04   ` David Hildenbrand
2020-08-30 10:08     ` Alex Shi
2020-08-30 10:14   ` Alex Shi
2020-08-30 10:18     ` Matthew Wilcox [this message]
2020-08-31  8:40       ` Alex Shi

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=20200830101823.GY14765@casper.infradead.org \
    --to=willy@infradead.org \
    --cc=akpm@linux-foundation.org \
    --cc=alex.shi@linux.alibaba.com \
    --cc=alexander.h.duyck@linux.intel.com \
    --cc=anshuman.khandual@arm.com \
    --cc=david@redhat.com \
    --cc=hughd@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    /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