Re: [PATCH 1/2] mm/pageblock: mitigation cmpxchg false sharing in pageblock flags

From: Alex Shi
Date: Sun Aug 16 2020 - 09:54:57 EST




在 2020/8/16 下午12:09, Matthew Wilcox 写道:
> On Sun, Aug 16, 2020 at 11:47:56AM +0800, Alex Shi wrote:
>> +++ b/mm/page_alloc.c
>> @@ -467,6 +467,8 @@ static inline int pfn_to_bitidx(struct page *page, unsigned long pfn)
>> return (pfn >> pageblock_order) * NR_PAGEBLOCK_BITS;
>> }
>>
>> +#define BITS_PER_CHAR 8
>
> include/linux/bits.h:#define BITS_PER_BYTE 8

Thank for reminder!

>
>> bitmap = get_pageblock_bitmap(page, pfn);
>> bitidx = pfn_to_bitidx(page, pfn);
>> - word_bitidx = bitidx / BITS_PER_LONG;
>> - bitidx &= (BITS_PER_LONG-1);
>> + word_bitidx = bitidx / BITS_PER_CHAR;
>> + bitidx &= (BITS_PER_CHAR-1);
>
> It's not a word any more. it's a byte.
>

Yes, will change this.
Thanks!