Re: [PATCH] mm, show_mem: drop pgdat_resize_lock in show_mem()

Michal Hocko
2018-11-29T16:18:51Z

On Thu 29-11-18 16:05:24, Wei Yang wrote:
> On Thu, Nov 29, 2018 at 04:49:22PM +0100, Michal Hocko wrote:
[...]
> >It is only called from __remove_pages and that one calls cond_resched so
> >obviosly not.
> >
>
> Forgive my poor background knowledge, I went throught the code, but not
> found where call cond_resched.
>
> __remove_pages()
> release_mem_region_adjustable()
> clear_zone_contiguous()
> __remove_section()
> unregister_memory_section()
> __remove_zone()
> sparse_remove_one_section()
> set_zone_contiguous()
>
> Would you mind giving me a hint?

This is the code as of 4.20-rc2

for (i = 0; i < sections_to_remove; i++) {
unsigned long pfn = phys_start_pfn + i*PAGES_PER_SECTION;

cond_resched();
ret = __remove_section(zone, __pfn_to_section(pfn), map_offset,
altmap);
map_offset = 0;
if (ret)
break;
}

Maybe things have changed in the meantime but in general the code is
sleepable (e.g. release_mem_region_adjustable does GFP_KERNEL
allocation) and that rules out IRQ context.
--
Michal Hocko
SUSE Labs