Message ID | 20230914140823.1732-1-justinjiang@vivo.com (mailing list archive) |
---|---|
State | New |
Headers | show |
Series | mm: mglru: fix add unevictable folio to lruvec->lists | expand |
On Thu, Sep 14, 2023 at 8:08 AM Zhiguo Jiang <justinjiang@vivo.com> wrote: > > The unevictable folio is not supported to add to lruvec->lists > in lruvec_add_folio(). > > So use lruvec_add_folio_tail() instead of lruvec_add_folio() > to add unevictable folio to lruvec->lists in sort_folio(). > > Signed-off-by: Zhiguo Jiang <justinjiang@vivo.com> > --- > mm/vmscan.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > mode change 100644 => 100755 mm/vmscan.c > > diff --git a/mm/vmscan.c b/mm/vmscan.c > index 661615fa709b..a15e45632034 > --- a/mm/vmscan.c > +++ b/mm/vmscan.c > @@ -4237,7 +4237,7 @@ static bool sort_folio(struct lruvec *lruvec, struct folio *folio, struct scan_c > success = lru_gen_del_folio(lruvec, folio, true); > VM_WARN_ON_ONCE_FOLIO(!success, folio); > folio_set_unevictable(folio); > - lruvec_add_folio(lruvec, folio); > + lruvec_add_folio_tail(lruvec, folio); > __count_vm_events(UNEVICTABLE_PGCULLED, delta); > return true; > } NAK. lruvec_add_folio() { ... if (lru != LRU_UNEVICTABLE) list_add(&folio->lru, &lruvec->lists[lru]); } lruvec_add_folio_tail() { ... /* This is not expected to be used on LRU_UNEVICTABLE */ list_add_tail(&folio->lru, &lruvec->lists[lru]); } struct page { ... union { struct list_head lru; /* Or, for the Unevictable "LRU list" slot */ struct { ... }
Hi Yu Zhao: How is the unevictable folio managed in kernel? Thanks -----邮件原件----- 发件人: Yu Zhao <yuzhao@google.com> 发送时间: 2023年9月15日 1:47 收件人: 江志国 <justinjiang@vivo.com> 抄送: Andrew Morton <akpm@linux-foundation.org>; linux-mm@kvack.org; linux-kernel@vger.kernel.org; opensource.kernel <opensource.kernel@vivo.com> 主题: Re: [PATCH] mm: mglru: fix add unevictable folio to lruvec->lists [你通常不会收到来自 yuzhao@google.com 的电子邮件。请访问 https://aka.ms/LearnAboutSenderIdentification,以了解这一点为什么很重要] On Thu, Sep 14, 2023 at 8:08 AM Zhiguo Jiang <justinjiang@vivo.com> wrote: > > The unevictable folio is not supported to add to lruvec->lists in > lruvec_add_folio(). > > So use lruvec_add_folio_tail() instead of lruvec_add_folio() to add > unevictable folio to lruvec->lists in sort_folio(). > > Signed-off-by: Zhiguo Jiang <justinjiang@vivo.com> > --- > mm/vmscan.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) mode change 100644 => > 100755 mm/vmscan.c > > diff --git a/mm/vmscan.c b/mm/vmscan.c index > 661615fa709b..a15e45632034 > --- a/mm/vmscan.c > +++ b/mm/vmscan.c > @@ -4237,7 +4237,7 @@ static bool sort_folio(struct lruvec *lruvec, struct folio *folio, struct scan_c > success = lru_gen_del_folio(lruvec, folio, true); > VM_WARN_ON_ONCE_FOLIO(!success, folio); > folio_set_unevictable(folio); > - lruvec_add_folio(lruvec, folio); > + lruvec_add_folio_tail(lruvec, folio); > __count_vm_events(UNEVICTABLE_PGCULLED, delta); > return true; > } NAK. lruvec_add_folio() { ... if (lru != LRU_UNEVICTABLE) list_add(&folio->lru, &lruvec->lists[lru]); } lruvec_add_folio_tail() { ... /* This is not expected to be used on LRU_UNEVICTABLE */ list_add_tail(&folio->lru, &lruvec->lists[lru]); } struct page { ... union { struct list_head lru; /* Or, for the Unevictable "LRU list" slot */ struct { ... }
On Thu, Sep 14, 2023 at 9:19 PM 江志国 <justinjiang@vivo.com> wrote: > > Hi Yu Zhao: > > How is the unevictable folio managed in kernel? https://www.kernel.org/doc/Documentation/vm/unevictable-lru.txt > On Thu, Sep 14, 2023 at 8:08 AM Zhiguo Jiang <justinjiang@vivo.com> wrote: > > > > The unevictable folio is not supported to add to lruvec->lists in > > lruvec_add_folio(). > > > > So use lruvec_add_folio_tail() instead of lruvec_add_folio() to add > > unevictable folio to lruvec->lists in sort_folio(). > > > > Signed-off-by: Zhiguo Jiang <justinjiang@vivo.com> > > --- > > mm/vmscan.c | 2 +- > > 1 file changed, 1 insertion(+), 1 deletion(-) mode change 100644 => > > 100755 mm/vmscan.c > > > > diff --git a/mm/vmscan.c b/mm/vmscan.c index > > 661615fa709b..a15e45632034 > > --- a/mm/vmscan.c > > +++ b/mm/vmscan.c > > @@ -4237,7 +4237,7 @@ static bool sort_folio(struct lruvec *lruvec, struct folio *folio, struct scan_c > > success = lru_gen_del_folio(lruvec, folio, true); > > VM_WARN_ON_ONCE_FOLIO(!success, folio); > > folio_set_unevictable(folio); > > - lruvec_add_folio(lruvec, folio); > > + lruvec_add_folio_tail(lruvec, folio); > > __count_vm_events(UNEVICTABLE_PGCULLED, delta); > > return true; > > } > > NAK. > > lruvec_add_folio() > { > ... > > if (lru != LRU_UNEVICTABLE) > list_add(&folio->lru, &lruvec->lists[lru]); } > > lruvec_add_folio_tail() > { > ... > > /* This is not expected to be used on LRU_UNEVICTABLE */ > list_add_tail(&folio->lru, &lruvec->lists[lru]); } > > struct page { > ... > union { > struct list_head lru; > > /* Or, for the Unevictable "LRU list" slot */ > struct { > ... > }
Hi Yu Zhao: Thank you for your reply and sharing. Zhiguo Jiang -----邮件原件----- 发件人: Yu Zhao <yuzhao@google.com> 发送时间: 2023年9月15日 11:25 收件人: 江志国 <justinjiang@vivo.com> 抄送: Andrew Morton <akpm@linux-foundation.org>; linux-mm@kvack.org; linux-kernel@vger.kernel.org; opensource.kernel <opensource.kernel@vivo.com> 主题: Re: [PATCH] mm: mglru: fix add unevictable folio to lruvec->lists [你通常不会收到来自 yuzhao@google.com 的电子邮件。请访问 https://aka.ms/LearnAboutSenderIdentification,以了解这一点为什么很重要] On Thu, Sep 14, 2023 at 9:19 PM 江志国 <justinjiang@vivo.com> wrote: > > Hi Yu Zhao: > > How is the unevictable folio managed in kernel? https://www.kernel.org/doc/Documentation/vm/unevictable-lru.txt > On Thu, Sep 14, 2023 at 8:08 AM Zhiguo Jiang <justinjiang@vivo.com> wrote: > > > > The unevictable folio is not supported to add to lruvec->lists in > > lruvec_add_folio(). > > > > So use lruvec_add_folio_tail() instead of lruvec_add_folio() to add > > unevictable folio to lruvec->lists in sort_folio(). > > > > Signed-off-by: Zhiguo Jiang <justinjiang@vivo.com> > > --- > > mm/vmscan.c | 2 +- > > 1 file changed, 1 insertion(+), 1 deletion(-) mode change 100644 > > => > > 100755 mm/vmscan.c > > > > diff --git a/mm/vmscan.c b/mm/vmscan.c index > > 661615fa709b..a15e45632034 > > --- a/mm/vmscan.c > > +++ b/mm/vmscan.c > > @@ -4237,7 +4237,7 @@ static bool sort_folio(struct lruvec *lruvec, struct folio *folio, struct scan_c > > success = lru_gen_del_folio(lruvec, folio, true); > > VM_WARN_ON_ONCE_FOLIO(!success, folio); > > folio_set_unevictable(folio); > > - lruvec_add_folio(lruvec, folio); > > + lruvec_add_folio_tail(lruvec, folio); > > __count_vm_events(UNEVICTABLE_PGCULLED, delta); > > return true; > > } > > NAK. > > lruvec_add_folio() > { > ... > > if (lru != LRU_UNEVICTABLE) > list_add(&folio->lru, &lruvec->lists[lru]); } > > lruvec_add_folio_tail() > { > ... > > /* This is not expected to be used on LRU_UNEVICTABLE */ > list_add_tail(&folio->lru, &lruvec->lists[lru]); } > > struct page { > ... > union { > struct list_head lru; > > /* Or, for the Unevictable "LRU list" slot */ > struct { > ... > }
On Thu, Sep 14, 2023 at 9:33 PM 江志国 <justinjiang@vivo.com> wrote: > > Hi Yu Zhao: > > Thank you for your reply and sharing. Sorry, wrong link. This is the right one: https://www.kernel.org/doc/html/latest/mm/unevictable-lru.html#the-unevictable-lru-folio-list > On Thu, Sep 14, 2023 at 9:19 PM 江志国 <justinjiang@vivo.com> wrote: > > > > Hi Yu Zhao: > > > > How is the unevictable folio managed in kernel? > > https://www.kernel.org/doc/Documentation/vm/unevictable-lru.txt > > > On Thu, Sep 14, 2023 at 8:08 AM Zhiguo Jiang <justinjiang@vivo.com> wrote: > > > > > > The unevictable folio is not supported to add to lruvec->lists in > > > lruvec_add_folio(). > > > > > > So use lruvec_add_folio_tail() instead of lruvec_add_folio() to add > > > unevictable folio to lruvec->lists in sort_folio(). > > > > > > Signed-off-by: Zhiguo Jiang <justinjiang@vivo.com> > > > --- > > > mm/vmscan.c | 2 +- > > > 1 file changed, 1 insertion(+), 1 deletion(-) mode change 100644 > > > => > > > 100755 mm/vmscan.c > > > > > > diff --git a/mm/vmscan.c b/mm/vmscan.c index > > > 661615fa709b..a15e45632034 > > > --- a/mm/vmscan.c > > > +++ b/mm/vmscan.c > > > @@ -4237,7 +4237,7 @@ static bool sort_folio(struct lruvec *lruvec, struct folio *folio, struct scan_c > > > success = lru_gen_del_folio(lruvec, folio, true); > > > VM_WARN_ON_ONCE_FOLIO(!success, folio); > > > folio_set_unevictable(folio); > > > - lruvec_add_folio(lruvec, folio); > > > + lruvec_add_folio_tail(lruvec, folio); > > > __count_vm_events(UNEVICTABLE_PGCULLED, delta); > > > return true; > > > } > > > > NAK. > > > > lruvec_add_folio() > > { > > ... > > > > if (lru != LRU_UNEVICTABLE) > > list_add(&folio->lru, &lruvec->lists[lru]); } > > > > lruvec_add_folio_tail() > > { > > ... > > > > /* This is not expected to be used on LRU_UNEVICTABLE */ > > list_add_tail(&folio->lru, &lruvec->lists[lru]); } > > > > struct page { > > ... > > union { > > struct list_head lru; > > > > /* Or, for the Unevictable "LRU list" slot */ > > struct { > > ... > > }
Thanks! -----邮件原件----- 发件人: Yu Zhao <yuzhao@google.com> 发送时间: 2023年9月15日 11:34 收件人: 江志国 <justinjiang@vivo.com> 抄送: Andrew Morton <akpm@linux-foundation.org>; linux-mm@kvack.org; linux-kernel@vger.kernel.org; opensource.kernel <opensource.kernel@vivo.com> 主题: Re: [PATCH] mm: mglru: fix add unevictable folio to lruvec->lists On Thu, Sep 14, 2023 at 9:33 PM 江志国 <justinjiang@vivo.com> wrote: > > Hi Yu Zhao: > > Thank you for your reply and sharing. Sorry, wrong link. This is the right one: https://www.kernel.org/doc/html/latest/mm/unevictable-lru.html#the-unevictable-lru-folio-list > On Thu, Sep 14, 2023 at 9:19 PM 江志国 <justinjiang@vivo.com> wrote: > > > > Hi Yu Zhao: > > > > How is the unevictable folio managed in kernel? > > https://www/. > kernel.org%2Fdoc%2FDocumentation%2Fvm%2Funevictable-lru.txt&data=05%7C > 01%7Cjustinjiang%40vivo.com%7Ca3ea4d61046d45c2b47608dbb59cc224%7C923e4 > 2dc48d54cbeb5821a797a6412ed%7C0%7C0%7C638303457153860664%7CUnknown%7CT > WFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI > 6Mn0%3D%7C3000%7C%7C%7C&sdata=MSl%2FThW4E%2FCevOTWEa1U7%2BrUZcho1bqWTH > Pa5QUx6O0%3D&reserved=0 > > > On Thu, Sep 14, 2023 at 8:08 AM Zhiguo Jiang <justinjiang@vivo.com> wrote: > > > > > > The unevictable folio is not supported to add to lruvec->lists in > > > lruvec_add_folio(). > > > > > > So use lruvec_add_folio_tail() instead of lruvec_add_folio() to > > > add unevictable folio to lruvec->lists in sort_folio(). > > > > > > Signed-off-by: Zhiguo Jiang <justinjiang@vivo.com> > > > --- > > > mm/vmscan.c | 2 +- > > > 1 file changed, 1 insertion(+), 1 deletion(-) mode change 100644 > > > => > > > 100755 mm/vmscan.c > > > > > > diff --git a/mm/vmscan.c b/mm/vmscan.c index > > > 661615fa709b..a15e45632034 > > > --- a/mm/vmscan.c > > > +++ b/mm/vmscan.c > > > @@ -4237,7 +4237,7 @@ static bool sort_folio(struct lruvec *lruvec, struct folio *folio, struct scan_c > > > success = lru_gen_del_folio(lruvec, folio, true); > > > VM_WARN_ON_ONCE_FOLIO(!success, folio); > > > folio_set_unevictable(folio); > > > - lruvec_add_folio(lruvec, folio); > > > + lruvec_add_folio_tail(lruvec, folio); > > > __count_vm_events(UNEVICTABLE_PGCULLED, delta); > > > return true; > > > } > > > > NAK. > > > > lruvec_add_folio() > > { > > ... > > > > if (lru != LRU_UNEVICTABLE) > > list_add(&folio->lru, &lruvec->lists[lru]); } > > > > lruvec_add_folio_tail() > > { > > ... > > > > /* This is not expected to be used on LRU_UNEVICTABLE */ > > list_add_tail(&folio->lru, &lruvec->lists[lru]); } > > > > struct page { > > ... > > union { > > struct list_head lru; > > > > /* Or, for the Unevictable "LRU list" slot */ > > struct { > > ... > > }
diff --git a/mm/vmscan.c b/mm/vmscan.c index 661615fa709b..a15e45632034 --- a/mm/vmscan.c +++ b/mm/vmscan.c @@ -4237,7 +4237,7 @@ static bool sort_folio(struct lruvec *lruvec, struct folio *folio, struct scan_c success = lru_gen_del_folio(lruvec, folio, true); VM_WARN_ON_ONCE_FOLIO(!success, folio); folio_set_unevictable(folio); - lruvec_add_folio(lruvec, folio); + lruvec_add_folio_tail(lruvec, folio); __count_vm_events(UNEVICTABLE_PGCULLED, delta); return true; }
The unevictable folio is not supported to add to lruvec->lists in lruvec_add_folio(). So use lruvec_add_folio_tail() instead of lruvec_add_folio() to add unevictable folio to lruvec->lists in sort_folio(). Signed-off-by: Zhiguo Jiang <justinjiang@vivo.com> --- mm/vmscan.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) mode change 100644 => 100755 mm/vmscan.c