Re: [Patch v2 4/6] x86/mm: Refine debug print string retrieval function

From: Wei Yang
Date: Fri Dec 06 2019 - 10:18:10 EST


On Fri, Dec 06, 2019 at 11:27:46AM +0100, Peter Zijlstra wrote:
>On Fri, Dec 06, 2019 at 09:51:26AM +0800, Wei Yang wrote:
>
>> >> +#if defined(CONFIG_X86_32) && !defined(CONFIG_X86_PAE)
>> >> + static const char *sz[2] = { "4K", "4M" };
>> >> +#else
>> >> + static const char *sz[4] = { "4K", "2M", "1G", "" };
>> >> +#endif
>> >> + unsigned int idx, s;
>> >>
>> >> + for (idx = 0; idx < maxidx; idx++, mr++) {
>> >> + s = (mr->page_size_mask >> PG_LEVEL_2M) & (ARRAY_SIZE(sz) - 1);
>> >
>> >Is it at all possible for !PAE to have 1G here, if you use the sz[4]
>> >definition unconditionally?
>> >
>>
>> You mean remove the ifdef and use sz[4] for both condition?
>>
>> Then how to differentiate 4M and 2M?
>
>Argh, I'm blind.. I failed to spot that. N/m then.

Never mind. I always do the same thing :-(

--
Wei Yang
Help you, Help me