* Re: [RFC v2] mm: add page preemption
[not found] <20191026112808.14268-1-hdanton@sina.com>
@ 2019-10-28 12:26 ` Kirill A. Shutemov
2019-10-28 15:56 ` Johannes Weiner
2019-10-29 8:41 ` Michal Hocko
2 siblings, 0 replies; 6+ messages in thread
From: Kirill A. Shutemov @ 2019-10-28 12:26 UTC (permalink / raw)
To: Hillf Danton
Cc: linux-mm, Andrew Morton, linux-kernel, Matthew Wilcox,
Michal Hocko, Johannes Weiner, Shakeel Butt, Minchan Kim,
Mel Gorman, Vladimir Davydov, Jan Kara
On Sat, Oct 26, 2019 at 07:28:08PM +0800, Hillf Danton wrote:
> @@ -218,6 +219,9 @@ struct page {
>
> #ifdef LAST_CPUPID_NOT_IN_PAGE_FLAGS
> int _last_cpupid;
> +#else
> + int prio;
> +#define CONFIG_PAGE_PREEMPTION PP
> #endif
> } _struct_page_alignment;
>
No.
There's a really good reason we trying hard to push the _last_cpuid into
page flags instead of growing the struct page by 4 bytes.
I don't think your feature worth 0.1% of RAM and a lot of cache misses
that this change would generate.
--
Kirill A. Shutemov
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [RFC v2] mm: add page preemption
[not found] <20191026112808.14268-1-hdanton@sina.com>
2019-10-28 12:26 ` [RFC v2] mm: add page preemption Kirill A. Shutemov
@ 2019-10-28 15:56 ` Johannes Weiner
2019-10-29 8:41 ` Michal Hocko
2 siblings, 0 replies; 6+ messages in thread
From: Johannes Weiner @ 2019-10-28 15:56 UTC (permalink / raw)
To: Hillf Danton
Cc: linux-mm, Andrew Morton, linux-kernel, Matthew Wilcox,
Michal Hocko, Shakeel Butt, Minchan Kim, Mel Gorman,
Vladimir Davydov, Jan Kara
On Sat, Oct 26, 2019 at 07:28:08PM +0800, Hillf Danton wrote:
>
> The cpu preemption feature makes a task able to preempt other tasks
> of lower priorities for cpu. It has been around for a while.
>
> This work introduces task prio into page reclaiming in order to add
> the page preemption feature that makes a task able to preempt other
> tasks of lower priorities for page.
>
> No page will be reclaimed on behalf of tasks of lower priorities
... at which point they'll declare OOM and kill the high-pri task?
Please have a look at the cgroup2 memory.low control. This memory
prioritization problem has already been solved.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [RFC v2] mm: add page preemption
[not found] <20191026112808.14268-1-hdanton@sina.com>
2019-10-28 12:26 ` [RFC v2] mm: add page preemption Kirill A. Shutemov
2019-10-28 15:56 ` Johannes Weiner
@ 2019-10-29 8:41 ` Michal Hocko
2019-10-29 15:27 ` Johannes Weiner
2 siblings, 1 reply; 6+ messages in thread
From: Michal Hocko @ 2019-10-29 8:41 UTC (permalink / raw)
To: Hillf Danton
Cc: linux-mm, Andrew Morton, linux-kernel, Matthew Wilcox,
Johannes Weiner, Shakeel Butt, Minchan Kim, Mel Gorman,
Vladimir Davydov, Jan Kara
On Sat 26-10-19 19:28:08, Hillf Danton wrote:
>
> The cpu preemption feature makes a task able to preempt other tasks
> of lower priorities for cpu. It has been around for a while.
>
> This work introduces task prio into page reclaiming in order to add
> the page preemption feature that makes a task able to preempt other
> tasks of lower priorities for page.
>
> No page will be reclaimed on behalf of tasks of lower priorities
> under pp, a two-edge feature that functions only under memory
> pressure, laying a barrier to pages flowing to lower prio, and the
> nice syscall is what users need to fiddle with it for instance as
> no task will be preempted without prio shades, if they have a couple
> of workloads that are sensitive to jitters in lru pages, and some
> difficulty predicting their working set sizes.
>
> Currently lru pages are reclaimed under memory pressure without prio
> taken into account; pages can be reclaimed from tasks of lower
> priorities on behalf of higher-prio tasks and vice versa.
>
> s/and vice versa/only/ is what we need to make pp by definition, but
> it could not make a sense without prio introduced in reclaiming,
> otherwise we can simply skip deactivating the lru pages based on prio
> comprison, and work is done.
>
> The introduction consists of two parts. On the page side, we have to
> store the page owner task's prio in page, which needs an extra room the
> size of the int type in the page struct.
>
> That room sounds impossible without inflating the page struct size, and
> it is not solved but walked around by sharing room with the 32-bit numa
> balancing, see 75980e97dacc ("mm: fold page->_last_nid into page->flags
> where possible").
>
> On the reclaimer side, kswapd's prio is set with the prio of its waker,
> and updated in the same manner as kswapd_order.
>
> V2 is based on next-20191018.
>
> Changes since v1
> - page->prio shares room with _last_cpupid as per Matthew Wilcox
>
> Changes since v0
> - s/page->nice/page->prio/
> - drop the role of kswapd's reclaiming prioirty in prio comparison
> - add pgdat->kswapd_prio
>
> Cc: Matthew Wilcox <willy@infradead.org>
> Cc: Michal Hocko <mhocko@suse.com>
> Cc: Johannes Weiner <hannes@cmpxchg.org>
> Cc: Shakeel Butt <shakeelb@google.com>
> Cc: Minchan Kim <minchan@kernel.org>
> Cc: Mel Gorman <mgorman@suse.de>
> Cc: Vladimir Davydov <vdavydov.dev@gmail.com>
> Cc: Jan Kara <jack@suse.cz>
> Signed-off-by: Hillf Danton <hdanton@sina.com>
As already raised in the review of v1. There is no real life usecase
described in the changelog. I have also expressed concerns about how
such a reclaim would work in the first place (priority inversion,
expensive reclaim etc.). Until that is provided/clarified
Nacked-by: Michal Hocko <mhocko@suse.com>
Please do not ignore review feedback in the future.
--
Michal Hocko
SUSE Labs
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [RFC v2] mm: add page preemption
2019-10-29 8:41 ` Michal Hocko
@ 2019-10-29 15:27 ` Johannes Weiner
0 siblings, 0 replies; 6+ messages in thread
From: Johannes Weiner @ 2019-10-29 15:27 UTC (permalink / raw)
To: Michal Hocko
Cc: Hillf Danton, linux-mm, Andrew Morton, linux-kernel,
Matthew Wilcox, Shakeel Butt, Minchan Kim, Mel Gorman,
Vladimir Davydov, Jan Kara
On Tue, Oct 29, 2019 at 09:41:53AM +0100, Michal Hocko wrote:
> As already raised in the review of v1. There is no real life usecase
> described in the changelog. I have also expressed concerns about how
> such a reclaim would work in the first place (priority inversion,
> expensive reclaim etc.). Until that is provided/clarified
>
> Nacked-by: Michal Hocko <mhocko@suse.com>
I second this.
Nacked-by: Johannes Weiner <hannes@cmpxchg.org>
^ permalink raw reply [flat|nested] 6+ messages in thread