Re: [PATCH] mm/memory_hotplug: drain per-cpu pages again during memory offline

2020-09-07 Thread Michal Hocko
On Fri 04-09-20 10:25:02, Pavel Tatashin wrote: > > Another alternative would be to enable/disable static branch only from > > users who really care but this is quite tricky because how do you tell > > you need or not? It seems that alloc_contig_range would be just fine > > with a weaker semantic

Re: [PATCH] mm/memory_hotplug: drain per-cpu pages again during memory offline

2020-09-04 Thread Pavel Tatashin
> Another alternative would be to enable/disable static branch only from > users who really care but this is quite tricky because how do you tell > you need or not? It seems that alloc_contig_range would be just fine > with a weaker semantic because it would "only" to a spurious failure. > Memory

Re: [PATCH] mm/memory_hotplug: drain per-cpu pages again during memory offline

2020-09-04 Thread Michal Hocko
On Thu 03-09-20 20:31:04, David Hildenbrand wrote: > On 03.09.20 20:23, Pavel Tatashin wrote: > > On Thu, Sep 3, 2020 at 2:20 PM David Hildenbrand wrote: > >> > >> On 03.09.20 08:38, Michal Hocko wrote: [...] > >>> diff --git a/mm/page_isolation.c b/mm/page_isolation.c > >>> index

Re: [PATCH] mm/memory_hotplug: drain per-cpu pages again during memory offline

2020-09-04 Thread Vlastimil Babka
On 9/3/20 8:23 PM, Pavel Tatashin wrote: >> >> As expressed in reply to v2, I dislike this hack. There is strong >> synchronization, just PCP is special. Allocating from MIGRATE_ISOLATE is >> just plain ugly. >> >> Can't we temporarily disable PCP (while some pageblock in the zone is >> isolated,

Re: [PATCH] mm/memory_hotplug: drain per-cpu pages again during memory offline

2020-09-03 Thread David Hildenbrand
On 03.09.20 20:23, Pavel Tatashin wrote: > On Thu, Sep 3, 2020 at 2:20 PM David Hildenbrand wrote: >> >> On 03.09.20 08:38, Michal Hocko wrote: >>> On Wed 02-09-20 19:51:45, Vlastimil Babka wrote: On 9/2/20 5:13 PM, Michal Hocko wrote: > On Wed 02-09-20 16:55:05, Vlastimil Babka wrote:

Re: [PATCH] mm/memory_hotplug: drain per-cpu pages again during memory offline

2020-09-03 Thread Pavel Tatashin
On Thu, Sep 3, 2020 at 2:20 PM David Hildenbrand wrote: > > On 03.09.20 08:38, Michal Hocko wrote: > > On Wed 02-09-20 19:51:45, Vlastimil Babka wrote: > >> On 9/2/20 5:13 PM, Michal Hocko wrote: > >>> On Wed 02-09-20 16:55:05, Vlastimil Babka wrote: > On 9/2/20 4:26 PM, Pavel Tatashin

Re: [PATCH] mm/memory_hotplug: drain per-cpu pages again during memory offline

2020-09-03 Thread David Hildenbrand
On 03.09.20 08:38, Michal Hocko wrote: > On Wed 02-09-20 19:51:45, Vlastimil Babka wrote: >> On 9/2/20 5:13 PM, Michal Hocko wrote: >>> On Wed 02-09-20 16:55:05, Vlastimil Babka wrote: On 9/2/20 4:26 PM, Pavel Tatashin wrote: > On Wed, Sep 2, 2020 at 10:08 AM Michal Hocko wrote: >>

Re: [PATCH] mm/memory_hotplug: drain per-cpu pages again during memory offline

2020-09-03 Thread Pavel Tatashin
Thanks Michal, I will add your comments. Pasha On Thu, Sep 3, 2020 at 3:07 AM Michal Hocko wrote: > > On Tue 01-09-20 08:46:15, Pavel Tatashin wrote: > [...] > > diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c > > index e9d5ab5d3ca0..d6d54922bfce 100644 > > --- a/mm/memory_hotplug.c > >

Re: [PATCH] mm/memory_hotplug: drain per-cpu pages again during memory offline

2020-09-03 Thread Vlastimil Babka
On 9/1/20 2:46 PM, Pavel Tatashin wrote: > There is a race during page offline that can lead to infinite loop: > a page never ends up on a buddy list and __offline_pages() keeps > retrying infinitely or until a termination signal is received. > > Thread#1 - a new process: > > load_elf_binary >

Re: [PATCH] mm/memory_hotplug: drain per-cpu pages again during memory offline

2020-09-03 Thread Michal Hocko
On Tue 01-09-20 08:46:15, Pavel Tatashin wrote: [...] > diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c > index e9d5ab5d3ca0..d6d54922bfce 100644 > --- a/mm/memory_hotplug.c > +++ b/mm/memory_hotplug.c > @@ -1575,6 +1575,15 @@ static int __ref __offline_pages(unsigned long > start_pfn, >

Re: [PATCH] mm/memory_hotplug: drain per-cpu pages again during memory offline

2020-09-03 Thread Michal Hocko
On Wed 02-09-20 19:51:45, Vlastimil Babka wrote: > On 9/2/20 5:13 PM, Michal Hocko wrote: > > On Wed 02-09-20 16:55:05, Vlastimil Babka wrote: > >> On 9/2/20 4:26 PM, Pavel Tatashin wrote: > >> > On Wed, Sep 2, 2020 at 10:08 AM Michal Hocko wrote: > >> >> > >> >> > > >> >> > Thread#1 - continue >

Re: [PATCH] mm/memory_hotplug: drain per-cpu pages again during memory offline

2020-09-02 Thread Vlastimil Babka
On 9/2/20 5:13 PM, Michal Hocko wrote: > On Wed 02-09-20 16:55:05, Vlastimil Babka wrote: >> On 9/2/20 4:26 PM, Pavel Tatashin wrote: >> > On Wed, Sep 2, 2020 at 10:08 AM Michal Hocko wrote: >> >> >> >> > >> >> > Thread#1 - continue >> >> > free_unref_page_commit >> >> >

Re: [PATCH] mm/memory_hotplug: drain per-cpu pages again during memory offline

2020-09-02 Thread Pavel Tatashin
> > >> But this means that the page is not isolated and so it could be reused > > >> for something else. No? > > > > > > The page is in a movable zone, has zero references, and the section is > > > isolated (i.e. set_pageblock_migratetype(page, MIGRATE_ISOLATE);) is > > > set. The page should be

Re: [PATCH] mm/memory_hotplug: drain per-cpu pages again during memory offline

2020-09-02 Thread Michal Hocko
On Wed 02-09-20 16:55:05, Vlastimil Babka wrote: > On 9/2/20 4:26 PM, Pavel Tatashin wrote: > > On Wed, Sep 2, 2020 at 10:08 AM Michal Hocko wrote: > >> > >> > > >> > Thread#1 - continue > >> > free_unref_page_commit > >> >migratetype = get_pcppage_migratetype(page); > >> >

Re: [PATCH] mm/memory_hotplug: drain per-cpu pages again during memory offline

2020-09-02 Thread Vlastimil Babka
On 9/2/20 4:26 PM, Pavel Tatashin wrote: > On Wed, Sep 2, 2020 at 10:08 AM Michal Hocko wrote: >> >> > >> > Thread#1 - continue >> > free_unref_page_commit >> >migratetype = get_pcppage_migratetype(page); >> > // get old migration type >> >

Re: [PATCH] mm/memory_hotplug: drain per-cpu pages again during memory offline

2020-09-02 Thread Vlastimil Babka
On 9/2/20 4:31 PM, Pavel Tatashin wrote: >> > > The fix is to try to drain per-cpu lists again after >> > > check_pages_isolated_cb() fails. >> >> Still trying to wrap my head around this but I think this is not a >> proper fix. It should be the page isolation to make sure no races are >> possible

Re: [PATCH] mm/memory_hotplug: drain per-cpu pages again during memory offline

2020-09-02 Thread Pavel Tatashin
> > > The fix is to try to drain per-cpu lists again after > > > check_pages_isolated_cb() fails. > > Still trying to wrap my head around this but I think this is not a > proper fix. It should be the page isolation to make sure no races are > possible with the page freeing path. > As Bharata B

Re: [PATCH] mm/memory_hotplug: drain per-cpu pages again during memory offline

2020-09-02 Thread Pavel Tatashin
On Wed, Sep 2, 2020 at 10:08 AM Michal Hocko wrote: > > On Tue 01-09-20 08:46:15, Pavel Tatashin wrote: > > There is a race during page offline that can lead to infinite loop: > > a page never ends up on a buddy list and __offline_pages() keeps > > retrying infinitely or until a termination

Re: [PATCH] mm/memory_hotplug: drain per-cpu pages again during memory offline

2020-09-02 Thread Michal Hocko
On Wed 02-09-20 16:01:17, Michal Hocko wrote: > [Cc Mel and Vlastimil - I am still rummaging] > > On Tue 01-09-20 08:46:15, Pavel Tatashin wrote: > > There is a race during page offline that can lead to infinite loop: > > a page never ends up on a buddy list and __offline_pages() keeps > >

Re: [PATCH] mm/memory_hotplug: drain per-cpu pages again during memory offline

2020-09-02 Thread Michal Hocko
On Tue 01-09-20 08:46:15, Pavel Tatashin wrote: > There is a race during page offline that can lead to infinite loop: > a page never ends up on a buddy list and __offline_pages() keeps > retrying infinitely or until a termination signal is received. > > Thread#1 - a new process: > >

Re: [PATCH] mm/memory_hotplug: drain per-cpu pages again during memory offline

2020-09-02 Thread Michal Hocko
[Cc Mel and Vlastimil - I am still rummaging] On Tue 01-09-20 08:46:15, Pavel Tatashin wrote: > There is a race during page offline that can lead to infinite loop: > a page never ends up on a buddy list and __offline_pages() keeps > retrying infinitely or until a termination signal is received. >

Re: [PATCH] mm/memory_hotplug: drain per-cpu pages again during memory offline

2020-09-01 Thread David Rientjes
On Tue, 1 Sep 2020, Pavel Tatashin wrote: > There is a race during page offline that can lead to infinite loop: > a page never ends up on a buddy list and __offline_pages() keeps > retrying infinitely or until a termination signal is received. > > Thread#1 - a new process: > > load_elf_binary >

Re: [PATCH] mm/memory_hotplug: drain per-cpu pages again during memory offline

2020-09-01 Thread Sasha Levin
Hi [This is an automated email] This commit has been processed because it contains a -stable tag. The stable tag indicates that it's relevant for the following trees: all The bot has tested the following trees: v5.8.5, v5.4.61, v4.19.142, v4.14.195, v4.9.234, v4.4.234. v5.8.5: Build OK!

[PATCH] mm/memory_hotplug: drain per-cpu pages again during memory offline

2020-09-01 Thread Pavel Tatashin
There is a race during page offline that can lead to infinite loop: a page never ends up on a buddy list and __offline_pages() keeps retrying infinitely or until a termination signal is received. Thread#1 - a new process: load_elf_binary begin_new_exec exec_mmap mmput exit_mmap