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

From: Alex Shi
Date: Sun Aug 16 2020 - 10:15:35 EST




在 2020/8/16 下午8:16, David Hildenbrand 写道:
> On 16.08.20 05:47, Alex Shi wrote:
>> pageblock_flags is used as long, since every pageblock_flags is just 4
>> bits, 'long' size will include 8(32bit machine) or 16 pageblocks' flags,
>> that flag setting has to sync in cmpxchg with 7 or 15 other pageblock
>> flags. It would cause long waiting for sync.
>>
>> If we could change the pageblock_flags variable as char, we could use
>> char size cmpxchg, which just sync up with 2 pageblock flags. it could
>> relief much false sharing in cmpxchg.
>
> Do you have any performance numbers to back your claims? IOW, do we care
> at all?
>
>

Hi David,

Thanks for comments!

Not yet, I trace the following commit here, with this commit this hot path
looks be resolved.

Thanks
Alex

e380bebe4771548 mm, compaction: keep migration source private to a single compaction instance
if (!locked) {
locked = compact_trylock_irqsave(zone_lru_lock(zone),
&flags, cc);
- if (!locked)
+
+ /* Allow future scanning if the lock is contended */
+ if (!locked) {
+ clear_pageblock_skip(page);
break;
+ }
+
+ /* Try get exclusive access under lock */
+ if (!skip_updated) {
+ skip_updated = true;
+ if (test_and_set_skip(cc, page, low_pfn))
+ goto isolate_abort;
+ }