All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] mm: mark folio as workingset in lru_deactivate_fn
@ 2023-03-29 10:47 zhaoyang.huang
  2023-03-29 14:55 ` Johannes Weiner
  0 siblings, 1 reply; 6+ messages in thread
From: zhaoyang.huang @ 2023-03-29 10:47 UTC (permalink / raw)
  To: Andrew Morton, Johannes Weiner, linux-mm, linux-kernel,
	Zhaoyang Huang, ke.wang

From: Zhaoyang Huang <zhaoyang.huang@unisoc.com>

folio will skip of being set as workingset in lru_deactivate_fn.

Signed-off-by: Zhaoyang Huang <zhaoyang.huang@unisoc.com>
---
 mm/swap.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/mm/swap.c b/mm/swap.c
index 70e2063..4d1c14f 100644
--- a/mm/swap.c
+++ b/mm/swap.c
@@ -603,6 +603,7 @@ static void lru_deactivate_file_fn(struct lruvec *lruvec, struct folio *folio)
 	lruvec_del_folio(lruvec, folio);
 	folio_clear_active(folio);
 	folio_clear_referenced(folio);
+	folio_set_workingset(folio);
 
 	if (folio_test_writeback(folio) || folio_test_dirty(folio)) {
 		/*
@@ -637,6 +638,7 @@ static void lru_deactivate_fn(struct lruvec *lruvec, struct folio *folio)
 		lruvec_del_folio(lruvec, folio);
 		folio_clear_active(folio);
 		folio_clear_referenced(folio);
+		folio_set_workingset(folio);
 		lruvec_add_folio(lruvec, folio);
 
 		__count_vm_events(PGDEACTIVATE, nr_pages);
-- 
1.9.1


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

* Re: [PATCH] mm: mark folio as workingset in lru_deactivate_fn
  2023-03-29 10:47 [PATCH] mm: mark folio as workingset in lru_deactivate_fn zhaoyang.huang
@ 2023-03-29 14:55 ` Johannes Weiner
  2023-03-30  1:38   ` Zhaoyang Huang
  0 siblings, 1 reply; 6+ messages in thread
From: Johannes Weiner @ 2023-03-29 14:55 UTC (permalink / raw)
  To: zhaoyang.huang
  Cc: Andrew Morton, linux-mm, linux-kernel, Zhaoyang Huang, ke.wang

On Wed, Mar 29, 2023 at 06:47:35PM +0800, zhaoyang.huang wrote:
> From: Zhaoyang Huang <zhaoyang.huang@unisoc.com>
> 
> folio will skip of being set as workingset in lru_deactivate_fn.

Can you please elaborate why that's undesirable? What's the problem
you're fixing?

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

* Re: [PATCH] mm: mark folio as workingset in lru_deactivate_fn
  2023-03-29 14:55 ` Johannes Weiner
@ 2023-03-30  1:38   ` Zhaoyang Huang
  2023-03-30  9:32     ` Johannes Weiner
  0 siblings, 1 reply; 6+ messages in thread
From: Zhaoyang Huang @ 2023-03-30  1:38 UTC (permalink / raw)
  To: Johannes Weiner
  Cc: zhaoyang.huang, Andrew Morton, linux-mm, linux-kernel, ke.wang

On Wed, Mar 29, 2023 at 10:55 PM Johannes Weiner <hannes@cmpxchg.org> wrote:
>
> On Wed, Mar 29, 2023 at 06:47:35PM +0800, zhaoyang.huang wrote:
> > From: Zhaoyang Huang <zhaoyang.huang@unisoc.com>
> >
> > folio will skip of being set as workingset in lru_deactivate_fn.
>
> Can you please elaborate why that's undesirable? What's the problem
> you're fixing?
If I am correct, folio will skip being set as workingset when moving
from active lru to inactive lru, which is performed on every folio in
shrink_active_list during normal reclaim.

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

* Re: [PATCH] mm: mark folio as workingset in lru_deactivate_fn
  2023-03-30  1:38   ` Zhaoyang Huang
@ 2023-03-30  9:32     ` Johannes Weiner
  2023-03-30  9:41       ` Zhaoyang Huang
  0 siblings, 1 reply; 6+ messages in thread
From: Johannes Weiner @ 2023-03-30  9:32 UTC (permalink / raw)
  To: Zhaoyang Huang
  Cc: zhaoyang.huang, Andrew Morton, linux-mm, linux-kernel, ke.wang

On Thu, Mar 30, 2023 at 09:38:48AM +0800, Zhaoyang Huang wrote:
> On Wed, Mar 29, 2023 at 10:55 PM Johannes Weiner <hannes@cmpxchg.org> wrote:
> >
> > On Wed, Mar 29, 2023 at 06:47:35PM +0800, zhaoyang.huang wrote:
> > > From: Zhaoyang Huang <zhaoyang.huang@unisoc.com>
> > >
> > > folio will skip of being set as workingset in lru_deactivate_fn.
> >
> > Can you please elaborate why that's undesirable? What's the problem
> > you're fixing?
> If I am correct, folio will skip being set as workingset when moving
> from active lru to inactive lru, which is performed on every folio in
> shrink_active_list during normal reclaim.

shrink_active_list directly calls folio_set_workingset(). The function
you're editing is used for things like MADV_COLD and truncate().

It sounds like there is just a misunderstanding of the code, not an
actual problem.

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

* Re: [PATCH] mm: mark folio as workingset in lru_deactivate_fn
  2023-03-30  9:32     ` Johannes Weiner
@ 2023-03-30  9:41       ` Zhaoyang Huang
  2023-04-03  8:18         ` Zhaoyang Huang
  0 siblings, 1 reply; 6+ messages in thread
From: Zhaoyang Huang @ 2023-03-30  9:41 UTC (permalink / raw)
  To: Johannes Weiner
  Cc: zhaoyang.huang, Andrew Morton, linux-mm, linux-kernel, ke.wang

On Thu, Mar 30, 2023 at 5:32 PM Johannes Weiner <hannes@cmpxchg.org> wrote:
>
> On Thu, Mar 30, 2023 at 09:38:48AM +0800, Zhaoyang Huang wrote:
> > On Wed, Mar 29, 2023 at 10:55 PM Johannes Weiner <hannes@cmpxchg.org> wrote:
> > >
> > > On Wed, Mar 29, 2023 at 06:47:35PM +0800, zhaoyang.huang wrote:
> > > > From: Zhaoyang Huang <zhaoyang.huang@unisoc.com>
> > > >
> > > > folio will skip of being set as workingset in lru_deactivate_fn.
> > >
> > > Can you please elaborate why that's undesirable? What's the problem
> > > you're fixing?
> > If I am correct, folio will skip being set as workingset when moving
> > from active lru to inactive lru, which is performed on every folio in
> > shrink_active_list during normal reclaim.
>
> shrink_active_list directly calls folio_set_workingset(). The function
> you're editing is used for things like MADV_COLD and truncate().
Yes.
>
> It sounds like there is just a misunderstanding of the code, not an
> actual problem.
Isn't that a problem? As my understanding, MADV_COLD could be deemed
as a stimulation of normal reclaiming which turbo the folio towards
eviction, while the page moving by it should be also delt in the same
way(PG_active has been cleaned)

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

* Re: [PATCH] mm: mark folio as workingset in lru_deactivate_fn
  2023-03-30  9:41       ` Zhaoyang Huang
@ 2023-04-03  8:18         ` Zhaoyang Huang
  0 siblings, 0 replies; 6+ messages in thread
From: Zhaoyang Huang @ 2023-04-03  8:18 UTC (permalink / raw)
  To: Johannes Weiner
  Cc: zhaoyang.huang, Andrew Morton, linux-mm, linux-kernel, ke.wang

On Thu, Mar 30, 2023 at 5:41 PM Zhaoyang Huang <huangzhaoyang@gmail.com> wrote:
>
> On Thu, Mar 30, 2023 at 5:32 PM Johannes Weiner <hannes@cmpxchg.org> wrote:
> >
> > On Thu, Mar 30, 2023 at 09:38:48AM +0800, Zhaoyang Huang wrote:
> > > On Wed, Mar 29, 2023 at 10:55 PM Johannes Weiner <hannes@cmpxchg.org> wrote:
> > > >
> > > > On Wed, Mar 29, 2023 at 06:47:35PM +0800, zhaoyang.huang wrote:
> > > > > From: Zhaoyang Huang <zhaoyang.huang@unisoc.com>
> > > > >
> > > > > folio will skip of being set as workingset in lru_deactivate_fn.
> > > >
> > > > Can you please elaborate why that's undesirable? What's the problem
> > > > you're fixing?
> > > If I am correct, folio will skip being set as workingset when moving
> > > from active lru to inactive lru, which is performed on every folio in
> > > shrink_active_list during normal reclaim.
> >
> > shrink_active_list directly calls folio_set_workingset(). The function
> > you're editing is used for things like MADV_COLD and truncate().
> Yes.
> >
> > It sounds like there is just a misunderstanding of the code, not an
> > actual problem.
> Isn't that a problem? As my understanding, MADV_COLD could be deemed
> as a stimulation of normal reclaiming which turbo the folio towards
> eviction, while the page moving by it should be also delt in the same
> way(PG_active has been cleaned)
Sorry, I am still confused. Does it mean the pages deactivated via
MADV_COLD like methods should NOT be deemed as workingset pages?

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

end of thread, other threads:[~2023-04-03  8:19 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-29 10:47 [PATCH] mm: mark folio as workingset in lru_deactivate_fn zhaoyang.huang
2023-03-29 14:55 ` Johannes Weiner
2023-03-30  1:38   ` Zhaoyang Huang
2023-03-30  9:32     ` Johannes Weiner
2023-03-30  9:41       ` Zhaoyang Huang
2023-04-03  8:18         ` Zhaoyang Huang

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.