linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Re: [RFC v2] mm: add page preemption
       [not found] <20191029123058.19060-1-hdanton@sina.com>
@ 2019-10-29 13:26 ` David Hildenbrand
  2019-10-29 13:41   ` Michal Hocko
  0 siblings, 1 reply; 6+ messages in thread
From: David Hildenbrand @ 2019-10-29 13:26 UTC (permalink / raw)
  To: Hillf Danton, Michal Hocko
  Cc: linux-mm, Andrew Morton, linux-kernel, Matthew Wilcox,
	Johannes Weiner, Shakeel Butt, Minchan Kim, Mel Gorman,
	Vladimir Davydov, Jan Kara

On 29.10.19 13:30, Hillf Danton wrote:
> 
> Date: Tue, 29 Oct 2019 09:41:53 +0100 Michal Hocko wrote:
>>
>> As already raised in the review of v1. There is no real life usecase
>> described in the changelog.
> 
> No feature, no user; no user, no workloads.
> No linux-6.x released, no 6.x users.
> Are you going to be one of the users of linux-6.0?
> 
> Even though, I see a use case over there at
> https://lore.kernel.org/lkml/20191023120452.GN754@dhcp22.suse.cz/
> 
> That thread terminated because of preemption, showing us how useful
> preemption might be in real life.
> 
>> I have also expressed concerns about how
>> such a reclaim would work in the first place
> 
> Based on what?
> 
>> (priority inversion,
> 
> No prio inversion will happen after introducing prio to global reclaim.
> 
>> expensive reclaim etc.).
> 
> No cost, no earn.
> 
> 

Side note: You should really have a look what your mail client is 
messing up here. E.g., the reply from Michal correctly had

Message-ID: <20191029084153.GD31513@dhcp22.suse.cz>
References: <20191026112808.14268-1-hdanton@sina.com>
In-Reply-To: <20191026112808.14268-1-hdanton@sina.com>

Once you reply to that, you have

Message-Id: <20191029123058.19060-1-hdanton@sina.com>
In-Reply-To: <20191026112808.14268-1-hdanton@sina.com>
References:

Instead of

Message-Id: <20191029123058.19060-1-hdanton@sina.com>
In-Reply-To: <20191029084153.GD31513@dhcp22.suse.cz>
References: <20191029084153.GD31513@dhcp22.suse.cz>

Which flattens the whole thread hierarchy. Nasty. Please fix that.

-- 

Thanks,

David / dhildenb


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [RFC v2] mm: add page preemption
  2019-10-29 13:26 ` [RFC v2] mm: add page preemption David Hildenbrand
@ 2019-10-29 13:41   ` Michal Hocko
  0 siblings, 0 replies; 6+ messages in thread
From: Michal Hocko @ 2019-10-29 13:41 UTC (permalink / raw)
  To: David Hildenbrand
  Cc: Hillf Danton, linux-mm, Andrew Morton, linux-kernel,
	Matthew Wilcox, Johannes Weiner, Shakeel Butt, Minchan Kim,
	Mel Gorman, Vladimir Davydov, Jan Kara

On Tue 29-10-19 14:26:36, David Hildenbrand wrote:
[...]
> Side note: You should really have a look what your mail client is messing up
> here. E.g., the reply from Michal correctly had
> 
> Message-ID: <20191029084153.GD31513@dhcp22.suse.cz>
> References: <20191026112808.14268-1-hdanton@sina.com>
> In-Reply-To: <20191026112808.14268-1-hdanton@sina.com>
> 
> Once you reply to that, you have
> 
> Message-Id: <20191029123058.19060-1-hdanton@sina.com>
> In-Reply-To: <20191026112808.14268-1-hdanton@sina.com>
> References:
> 
> Instead of
> 
> Message-Id: <20191029123058.19060-1-hdanton@sina.com>
> In-Reply-To: <20191029084153.GD31513@dhcp22.suse.cz>
> References: <20191029084153.GD31513@dhcp22.suse.cz>
> 
> Which flattens the whole thread hierarchy. Nasty. Please fix that.

This is not for the first time. It's been like that for a longer time
and several people have noted that before.
-- 
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

* 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
  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
       [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: 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 ` 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

end of thread, other threads:[~2019-10-29 15:27 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <20191029123058.19060-1-hdanton@sina.com>
2019-10-29 13:26 ` [RFC v2] mm: add page preemption David Hildenbrand
2019-10-29 13:41   ` Michal Hocko
     [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
2019-10-29 15:27   ` Johannes Weiner

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).