Re: [PATCH 4/5] mm/hotplug: Avoid RCU stalls when removing large amounts of memory

From: Michal Hocko
Date: Mon Jun 17 2019 - 03:52:10 EST


On Mon 17-06-19 14:36:30, Alastair D'Silva wrote:
> From: Alastair D'Silva <alastair@xxxxxxxxxxx>
>
> When removing sufficiently large amounts of memory, we trigger RCU stall
> detection. By periodically calling cond_resched(), we avoid bogus stall
> warnings.
>
> Signed-off-by: Alastair D'Silva <alastair@xxxxxxxxxxx>
> ---
> mm/memory_hotplug.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c
> index e096c987d261..382b3a0c9333 100644
> --- a/mm/memory_hotplug.c
> +++ b/mm/memory_hotplug.c
> @@ -578,6 +578,9 @@ void __remove_pages(struct zone *zone, unsigned long phys_start_pfn,
> __remove_section(zone, __pfn_to_section(pfn), map_offset,
> altmap);
> map_offset = 0;
> +
> + if (!(i & 0x0FFF))
> + cond_resched();

We already do have cond_resched before __remove_section. Why is an
additional needed?

> }
>
> set_zone_contiguous(zone);
> --
> 2.21.0
>

--
Michal Hocko
SUSE Labs