Re: [RFC] mm/pgtable/debug: Add test validating architecture page table helpers

From: Anshuman Khandual
Date: Fri Jul 26 2019 - 00:28:27 EST



On 07/25/2019 10:37 PM, Catalin Marinas wrote:
> On Thu, Jul 25, 2019 at 12:25:23PM +0530, Anshuman Khandual wrote:
>> +#if !defined(__PAGETABLE_PMD_FOLDED) && !defined(__ARCH_HAS_4LEVEL_HACK)
>> +static void pud_clear_tests(void)
>> +{
>> + pud_t pud;
>> +
>> + pud_clear(&pud);
>> + WARN_ON(!pud_none(pud));
>> +}
>
> For the clear tests, I think you should initialise the local variable to
> something non-zero rather than rely on whatever was on the stack. In
> case it fails, you have a more deterministic behaviour.

Sure, it makes sense, will change.