Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1722365
| From | Michal Hocko <mhocko@kernel.org> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH] mm, memory_hotplug: do not back off draining pcp free pages from kworker context |
| Date | 2017-08-29 13:30 +0200 |
| Message-ID | <ujMSu-1Zf-23@gated-at.bofh.it> (permalink) |
| References | <ujoGu-3Tj-31@gated-at.bofh.it> <ujARj-2QC-3@gated-at.bofh.it> <ujMSu-1Zf-21@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
On Tue 29-08-17 20:20:39, Tetsuo Handa wrote:
> On 2017/08/29 7:33, Andrew Morton wrote:
> > On Mon, 28 Aug 2017 11:33:41 +0200 Michal Hocko <mhocko@kernel.org> wrote:
> >
> >> drain_all_pages backs off when called from a kworker context since
> >> 0ccce3b924212 ("mm, page_alloc: drain per-cpu pages from workqueue
> >> context") because the original IPI based pcp draining has been replaced
> >> by a WQ based one and the check wanted to prevent from recursion and
> >> inter workers dependencies. This has made some sense at the time
> >> because the system WQ has been used and one worker holding the lock
> >> could be blocked while waiting for new workers to emerge which can be a
> >> problem under OOM conditions.
> >>
> >> Since then ce612879ddc7 ("mm: move pcp and lru-pcp draining into single
> >> wq") has moved draining to a dedicated (mm_percpu_wq) WQ with a rescuer
> >> so we shouldn't depend on any other WQ activity to make a forward
> >> progress so calling drain_all_pages from a worker context is safe as
> >> long as this doesn't happen from mm_percpu_wq itself which is not the
> >> case because all workers are required to _not_ depend on any MM locks.
> >>
> >> Why is this a problem in the first place? ACPI driven memory hot-remove
> >> (acpi_device_hotplug) is executed from the worker context. We end
> >> up calling __offline_pages to free all the pages and that requires
> >> both lru_add_drain_all_cpuslocked and drain_all_pages to do their job
> >> otherwise we can have dangling pages on pcp lists and fail the offline
> >> operation (__test_page_isolated_in_pageblock would see a page with 0
> >> ref. count but without PageBuddy set).
> >>
> >> Fix the issue by removing the worker check in drain_all_pages.
> >> lru_add_drain_all_cpuslocked doesn't have this restriction so it works
> >> as expected.
> >>
> >> Fixes: 0ccce3b924212 ("mm, page_alloc: drain per-cpu pages from workqueue context")
> >> Signed-off-by: Michal Hocko <mhocko@suse.com>
> >
> > No cc:stable?
> >
>
> Michal, are you sure that this patch does not cause deadlock?
>
> As shown in "[PATCH] mm: Use WQ_HIGHPRI for mm_percpu_wq." thread, currently work
> items on mm_percpu_wq seem to be blocked by other work items not on mm_percpu_wq.
But we have a rescuer so we should make a forward progress eventually.
Or am I missing something. Tejun, could you have a look please?/
--
Michal Hocko
SUSE Labs
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH] mm, memory_hotplug: do not back off draining pcp free pages from kworker context Michal Hocko <mhocko@kernel.org> - 2017-08-28 11:40 +0200
Re: [PATCH] mm, memory_hotplug: do not back off draining pcp free pages from kworker context Andrew Morton <akpm@linux-foundation.org> - 2017-08-29 00:40 +0200
Re: [PATCH] mm, memory_hotplug: do not back off draining pcp free pages from kworker context Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp> - 2017-08-29 13:30 +0200
Re: [PATCH] mm, memory_hotplug: do not back off draining pcp free pages from kworker context Michal Hocko <mhocko@kernel.org> - 2017-08-29 13:30 +0200
Re: [PATCH] mm, memory_hotplug: do not back off draining pcp free pages from kworker context Michal Hocko <mhocko@kernel.org> - 2017-08-31 07:40 +0200
Re: [PATCH] mm, memory_hotplug: do not back off draining pcp free pages from kworker context Michal Hocko <mhocko@kernel.org> - 2017-08-29 16:00 +0200
csiph-web