On Wed, Nov 28, 2018 at 03:00:52PM -0800, Andrew Morton wrote: >On Wed, 28 Nov 2018 16:36:34 +0800 Wei Yang <richard.weiyang@xxxxxxxxx> wrote: > >> When DEFERRED_STRUCT_PAGE_INIT is set, page struct will not be >> initialized all at boot up. Some of them is postponed to defer stage. >> While the global variable highest_memmap_pfn is still set to the highest >> pfn at boot up, even some of them are not initialized. >> >> This patch adjust this behavior by update highest_memmap_pfn with the >> exact pfn during each iteration. Since each node has a defer thread, >> introduce a spin lock to protect it. >> > >Does this solve any known problems? If so then I'm suspecting that >those problems go deeper than this. Corrently I don't see any problem. > >Why use a spinlock rather than an atomic_long_t? Sorry for my shortage in knowledge. I am not sure how to compare and change a value atomicly. cmpxchg just could compare the exact value. > >Perhaps this check should instead be built into pfn_valid()? I think the original commit 22b31eec63e5 ('badpage: vm_normal_page use print_bad_pte') introduce highest_memmap_pfn to make pfn_valid() cheaper. Some definition of pfn_valid() is : #define pfn_valid(pfn) ((pfn) < max_pfn) Which doesn't care about the exact presented or memmap-ed page. I am not for sure all pfn_valid() could leverage this. One thing for sure is there are only two users of highest_memmap_pfn * vm_normal_page_pmd * _vm_normal_page -- Wei Yang Help you, Help me