Re: [PATCH v5 01/11] mm: x86: move _PAGE_SWP_SOFT_DIRTY from bit 7 to bit 1

From: Dave Hansen
Date: Fri May 19 2017 - 12:36:43 EST


On 05/19/2017 09:31 AM, Zi Yan wrote:
>> This description lacks a problem statement. What's the problem?
>>
>> _PAGE_PSE is used to distinguish between a truly non-present
>> (_PAGE_PRESENT=0) PMD, and a PMD which is undergoing a THP
>> split and should be treated as present.
>>
>> But _PAGE_SWP_SOFT_DIRTY currently uses the _PAGE_PSE bit,
>> which would cause confusion between one of those PMDs
>> undergoing a THP split, and a soft-dirty PMD.
>>
>> Thus, we need to move the bit.
>>
>> Does that capture it?
> Yes. I will add this in the next version.

OK, thanks for clarifying. You can add my acked-by on this.

But, generally, these bits really scare me. We don't have any nice
programmatic way to find conflicts. I really wish we had some
BUILD_BUG_ON()s or something to express these dependencies.