linux-next.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* linux-next: manual merge of the mm tree with the folio tree
@ 2022-05-12  8:26 Stephen Rothwell
  2022-05-12 11:52 ` Ryusuke Konishi
  0 siblings, 1 reply; 11+ messages in thread
From: Stephen Rothwell @ 2022-05-12  8:26 UTC (permalink / raw)
  To: Andrew Morton, Matthew Wilcox
  Cc: Linux Kernel Mailing List, Linux Next Mailing List,
	Ryusuke Konishi, Yang Li

[-- Attachment #1: Type: text/plain, Size: 1626 bytes --]

Hi all,

Today's linux-next merge of the mm tree got a conflict in:

  fs/nilfs2/inode.c

between commit:

  f132ab7d3ab0 ("fs: Convert mpage_readpage to mpage_read_folio")

from the folio tree and commit:

  e38ed506c42f ("nilfs2: Fix some kernel-doc comments")

from the mm tree.

I fixed it up (see below) and can carry the fix as necessary. This
is now fixed as far as linux-next is concerned, but any non trivial
conflicts should be mentioned to your upstream maintainer when your tree
is submitted for merging.  You may also want to consider cooperating
with the maintainer of the conflicting tree to minimise any particularly
complex conflicts.

-- 
Cheers,
Stephen Rothwell

diff --cc fs/nilfs2/inode.c
index 538ca5473b0d,6a00cf324cbd..000000000000
--- a/fs/nilfs2/inode.c
+++ b/fs/nilfs2/inode.c
@@@ -140,14 -140,14 +140,14 @@@ int nilfs_get_block(struct inode *inode
  }
  
  /**
 - * nilfs_readpage() - implement readpage() method of nilfs_aops {}
 + * nilfs_read_folio() - implement read_folio() method of nilfs_aops {}
   * address_space_operations.
-  * @file - file struct of the file to be read
-  * @folio - the folio to be read
+  * @file: file struct of the file to be read
 - * @page: the page to be read
++ * @folio: the folio to be read
   */
 -static int nilfs_readpage(struct file *file, struct page *page)
 +static int nilfs_read_folio(struct file *file, struct folio *folio)
  {
 -	return mpage_readpage(page, nilfs_get_block);
 +	return mpage_read_folio(folio, nilfs_get_block);
  }
  
  static void nilfs_readahead(struct readahead_control *rac)

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

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

* Re: linux-next: manual merge of the mm tree with the folio tree
  2022-05-12  8:26 linux-next: manual merge of the mm tree with the folio tree Stephen Rothwell
@ 2022-05-12 11:52 ` Ryusuke Konishi
  2022-05-12 12:51   ` Matthew Wilcox
  0 siblings, 1 reply; 11+ messages in thread
From: Ryusuke Konishi @ 2022-05-12 11:52 UTC (permalink / raw)
  To: Andrew Morton, Stephen Rothwell
  Cc: Matthew Wilcox, Linux Kernel Mailing List,
	Linux Next Mailing List, Yang Li

On Thu, May 12, 2022 at 5:26 PM Stephen Rothwell <sfr@canb.auug.org.au> wrote:
>
> Hi all,
>
> Today's linux-next merge of the mm tree got a conflict in:
>
>   fs/nilfs2/inode.c
>
> between commit:
>
>   f132ab7d3ab0 ("fs: Convert mpage_readpage to mpage_read_folio")
>
> from the folio tree and commit:
>
>   e38ed506c42f ("nilfs2: Fix some kernel-doc comments")
>
> from the mm tree.
>
> I fixed it up (see below) and can carry the fix as necessary. This
> is now fixed as far as linux-next is concerned, but any non trivial
> conflicts should be mentioned to your upstream maintainer when your tree
> is submitted for merging.  You may also want to consider cooperating
> with the maintainer of the conflicting tree to minimise any particularly
> complex conflicts.

Thanks, Stephen.

Andrew,  please once drop

 e38ed506c42f ("nilfs2: Fix some kernel-doc comments")

from -mm tree.   I will resend a modified patch after the folio patch is merged
to the mainline.

Thanks,
Ryusuke Konishi

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

* Re: linux-next: manual merge of the mm tree with the folio tree
  2022-05-12 11:52 ` Ryusuke Konishi
@ 2022-05-12 12:51   ` Matthew Wilcox
  2022-05-12 16:13     ` Ryusuke Konishi
  0 siblings, 1 reply; 11+ messages in thread
From: Matthew Wilcox @ 2022-05-12 12:51 UTC (permalink / raw)
  To: Ryusuke Konishi
  Cc: Andrew Morton, Stephen Rothwell, Linux Kernel Mailing List,
	Linux Next Mailing List, Yang Li

On Thu, May 12, 2022 at 08:52:17PM +0900, Ryusuke Konishi wrote:
> On Thu, May 12, 2022 at 5:26 PM Stephen Rothwell <sfr@canb.auug.org.au> wrote:
> >
> > Hi all,
> >
> > Today's linux-next merge of the mm tree got a conflict in:
> >
> >   fs/nilfs2/inode.c
> >
> > between commit:
> >
> >   f132ab7d3ab0 ("fs: Convert mpage_readpage to mpage_read_folio")
> >
> > from the folio tree and commit:
> >
> >   e38ed506c42f ("nilfs2: Fix some kernel-doc comments")
> >
> > from the mm tree.
> >
> > I fixed it up (see below) and can carry the fix as necessary. This
> > is now fixed as far as linux-next is concerned, but any non trivial
> > conflicts should be mentioned to your upstream maintainer when your tree
> > is submitted for merging.  You may also want to consider cooperating
> > with the maintainer of the conflicting tree to minimise any particularly
> > complex conflicts.
> 
> Thanks, Stephen.
> 
> Andrew,  please once drop
> 
>  e38ed506c42f ("nilfs2: Fix some kernel-doc comments")
> 
> from -mm tree.   I will resend a modified patch after the folio patch is merged
> to the mainline.

I'd be happy to take this patch through my tree instead, if you point me
to where I can pick it up (I don't see it on fsdevel or mm).

Although I do think we need to consider whether implementations of
fs entry points (aops, fops, iops, etc) should have documentation in
the individual filesystems.  I understand why individual filesystem
authors want that, but it would be better if we had really
good central documentation of VFS/FS requirements (and honestly
Documentation/filesystems/{locking.rst,vfs.rst} aren't bad) instead of
reiterating them in each individual filesystem.

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

* Re: linux-next: manual merge of the mm tree with the folio tree
  2022-05-12 12:51   ` Matthew Wilcox
@ 2022-05-12 16:13     ` Ryusuke Konishi
  0 siblings, 0 replies; 11+ messages in thread
From: Ryusuke Konishi @ 2022-05-12 16:13 UTC (permalink / raw)
  To: Matthew Wilcox, Andrew Morton
  Cc: Stephen Rothwell, Linux Kernel Mailing List,
	Linux Next Mailing List, Yang Li

On Thu, May 12, 2022 at 9:51 PM Matthew Wilcox <willy@infradead.org> wrote:
>
> On Thu, May 12, 2022 at 08:52:17PM +0900, Ryusuke Konishi wrote:
> > On Thu, May 12, 2022 at 5:26 PM Stephen Rothwell <sfr@canb.auug.org.au> wrote:
> > >
> > > Hi all,
> > >
> > > Today's linux-next merge of the mm tree got a conflict in:
> > >
> > >   fs/nilfs2/inode.c
> > >
> > > between commit:
> > >
> > >   f132ab7d3ab0 ("fs: Convert mpage_readpage to mpage_read_folio")
> > >
> > > from the folio tree and commit:
> > >
> > >   e38ed506c42f ("nilfs2: Fix some kernel-doc comments")
> > >
> > > from the mm tree.
> > >
> > > I fixed it up (see below) and can carry the fix as necessary. This
> > > is now fixed as far as linux-next is concerned, but any non trivial
> > > conflicts should be mentioned to your upstream maintainer when your tree
> > > is submitted for merging.  You may also want to consider cooperating
> > > with the maintainer of the conflicting tree to minimise any particularly
> > > complex conflicts.
> >
> > Thanks, Stephen.
> >
> > Andrew,  please once drop
> >
> >  e38ed506c42f ("nilfs2: Fix some kernel-doc comments")
> >
> > from -mm tree.   I will resend a modified patch after the folio patch is merged
> > to the mainline.
>
> I'd be happy to take this patch through my tree instead, if you point me
> to where I can pick it up (I don't see it on fsdevel or mm).

Thank you for your suggestion.   The patch I signed is below,

 https://lkml.kernel.org/r/1652276316-7791-1-git-send-email-konishi.ryusuke@gmail.com

but I guess it's better to pick up Andrew's, which seems to have been
sent to you
additionally a while ago, if it's OK for Andrew as well.

Regards,
Ryusuke Konishi

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

* Re: linux-next: manual merge of the mm tree with the folio tree
  2022-06-22 18:59   ` Andrew Morton
@ 2022-06-23  2:15     ` Muchun Song
  0 siblings, 0 replies; 11+ messages in thread
From: Muchun Song @ 2022-06-23  2:15 UTC (permalink / raw)
  To: Andrew Morton
  Cc: Stephen Rothwell, Matthew Wilcox, Linux Kernel Mailing List,
	Linux Next Mailing List

On Thu, Jun 23, 2022 at 2:59 AM Andrew Morton <akpm@linux-foundation.org> wrote:
>
> On Wed, 22 Jun 2022 15:22:35 +0800 Muchun Song <songmuchun@bytedance.com> wrote:
>
> > > Today's linux-next merge of the mm tree got a conflict in:
> > >
> > >   mm/vmscan.c
> > >
> > > between commit:
> > >
> > >   15077be8badc ("vmscan: Add check_move_unevictable_folios()")
> >
> > Sorry for the conflicts, I didn't see this change in the mm-unstable branch
> > yesterday. Based on this commit, I have reworked the following commit
> > (see attachment, mainly changes are about check_move_unevictable_folios()).
> > Andrew can pick it up if he wants to replace the original patch with
> > the new one.
>
> Your comments in
> https://lkml.kernel.org/r/YrM2XCwzu65cb81r@FVFYT0MHHV2J.googleapis.com
> make me wonder whether simply dropping cca700a8e695 ("mm: lru: use
> lruvec lock to serialize memcg changes") would be best?
>

Hi Andrew,

Well, I think we can drop this now. After memcg reparenting work stabilizes,
I will resend this patch again.

Thanks.

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

* Re: linux-next: manual merge of the mm tree with the folio tree
  2022-06-22  7:22 ` Muchun Song
@ 2022-06-22 18:59   ` Andrew Morton
  2022-06-23  2:15     ` Muchun Song
  0 siblings, 1 reply; 11+ messages in thread
From: Andrew Morton @ 2022-06-22 18:59 UTC (permalink / raw)
  To: Muchun Song
  Cc: Stephen Rothwell, Matthew Wilcox, Linux Kernel Mailing List,
	Linux Next Mailing List

On Wed, 22 Jun 2022 15:22:35 +0800 Muchun Song <songmuchun@bytedance.com> wrote:

> > Today's linux-next merge of the mm tree got a conflict in:
> >
> >   mm/vmscan.c
> >
> > between commit:
> >
> >   15077be8badc ("vmscan: Add check_move_unevictable_folios()")
> 
> Sorry for the conflicts, I didn't see this change in the mm-unstable branch
> yesterday. Based on this commit, I have reworked the following commit
> (see attachment, mainly changes are about check_move_unevictable_folios()).
> Andrew can pick it up if he wants to replace the original patch with
> the new one.

Your comments in
https://lkml.kernel.org/r/YrM2XCwzu65cb81r@FVFYT0MHHV2J.googleapis.com
make me wonder whether simply dropping cca700a8e695 ("mm: lru: use
lruvec lock to serialize memcg changes") would be best?


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

* Re: linux-next: manual merge of the mm tree with the folio tree
  2022-06-22  5:38 Stephen Rothwell
@ 2022-06-22  7:22 ` Muchun Song
  2022-06-22 18:59   ` Andrew Morton
  0 siblings, 1 reply; 11+ messages in thread
From: Muchun Song @ 2022-06-22  7:22 UTC (permalink / raw)
  To: Stephen Rothwell
  Cc: Andrew Morton, Matthew Wilcox, Linux Kernel Mailing List,
	Linux Next Mailing List

[-- Attachment #1: Type: text/plain, Size: 2789 bytes --]

On Wed, Jun 22, 2022 at 1:38 PM Stephen Rothwell <sfr@canb.auug.org.au> wrote:
>
> Hi all,
>
> Today's linux-next merge of the mm tree got a conflict in:
>
>   mm/vmscan.c
>
> between commit:
>
>   15077be8badc ("vmscan: Add check_move_unevictable_folios()")

Sorry for the conflicts, I didn't see this change in the mm-unstable branch
yesterday. Based on this commit, I have reworked the following commit
(see attachment, mainly changes are about check_move_unevictable_folios()).
Andrew can pick it up if he wants to replace the original patch with
the new one.

>
> from the folio tree and commits:
>
>   cca700a8e695 ("mm: lru: use lruvec lock to serialize memcg changes")
>
> from the mm tree.
>
> I fixed it up (see below) and can carry the fix as necessary. This
> is now fixed as far as linux-next is concerned, but any non trivial
> conflicts should be mentioned to your upstream maintainer when your tree
> is submitted for merging.  You may also want to consider cooperating
> with the maintainer of the conflicting tree to minimise any particularly
> complex conflicts.
>
> --
> Cheers,
> Stephen Rothwell
>
> diff --cc mm/vmscan.c
> index 04f8671caad9,60335f974803..000000000000
> --- a/mm/vmscan.c
> +++ b/mm/vmscan.c
> @@@ -4823,18 -4856,22 +4873,17 @@@ void check_move_unevictable_folios(stru
>         int pgrescued = 0;
>         int i;
>
>  -      for (i = 0; i < pvec->nr; i++) {
>  -              struct page *page = pvec->pages[i];
>  -              struct folio *folio = page_folio(page);
>  -              int nr_pages;
>  -
>  -              if (PageTransTail(page))
>  -                      continue;
>  +      for (i = 0; i < fbatch->nr; i++) {
>  +              struct folio *folio = fbatch->folios[i];
>  +              int nr_pages = folio_nr_pages(folio);
>
>  -              nr_pages = folio_nr_pages(folio);
>                 pgscanned += nr_pages;
>
> -               /* block memcg migration while the folio moves between lrus */
> -               if (!folio_test_clear_lru(folio))
> +               lruvec = folio_lruvec_relock_irq(folio, lruvec);
> +               if (!folio_test_lru(folio) || !folio_test_unevictable(folio))
>                         continue;
>
> -               lruvec = folio_lruvec_relock_irq(folio, lruvec);
> -               if (folio_evictable(folio) && folio_test_unevictable(folio)) {
> +               if (folio_evictable(folio)) {
>                         lruvec_del_folio(lruvec, folio);
>                         folio_clear_unevictable(folio);
>                         lruvec_add_folio(lruvec, folio);

The above fix is no problem. But I have something to confirm since I
do not see the next lines of the code.  There is a "folio_set_lru(folio);"
in the end of this if branch, it should be removed as well.

Thanks.

[-- Attachment #2: 0001-mm-lru-use-lruvec-lock-to-serialize-memcg-changes.patch --]
[-- Type: application/octet-stream, Size: 7510 bytes --]

From 5d2a41cb2d14c975cfb52588d2e2a57837238920 Mon Sep 17 00:00:00 2001
From: Muchun Song <songmuchun@bytedance.com>
Date: Mon, 5 Apr 2021 17:28:04 +0800
Subject: [PATCH] mm: lru: use lruvec lock to serialize memcg changes

As described by commit fc574c23558c ("mm/swap.c: serialize memcg
changes in pagevec_lru_move_fn"), TestClearPageLRU() aims to
serialize mem_cgroup_move_account() during pagevec_lru_move_fn().
Now folio_lruvec_lock*() has the ability to detect whether page
memcg has been changed. So we can use lruvec lock to serialize
mem_cgroup_move_account() during pagevec_lru_move_fn(). This
change is a partial revert of the commit fc574c23558c ("mm/swap.c:
serialize memcg changes in pagevec_lru_move_fn").

And pagevec_lru_move_fn() is more hot compare with
mem_cgroup_move_account(), removing an atomic operation would be
an optimization. Also this change would not dirty cacheline for a
page which isn't on the LRU.

Signed-off-by: Muchun Song <songmuchun@bytedance.com>
---
 mm/memcontrol.c | 34 ++++++++++++++++++++++++++++++++++
 mm/swap.c       | 32 +++++++++++++++-----------------
 mm/vmscan.c     |  7 ++-----
 3 files changed, 51 insertions(+), 22 deletions(-)

diff --git a/mm/memcontrol.c b/mm/memcontrol.c
index 803dbdf5f233..85adc43c5a25 100644
--- a/mm/memcontrol.c
+++ b/mm/memcontrol.c
@@ -1330,10 +1330,39 @@ struct lruvec *folio_lruvec_lock(struct folio *folio)
 	lruvec = folio_lruvec(folio);
 	spin_lock(&lruvec->lru_lock);
 
+	/*
+	 * The memcg of the page can be changed by any the following routines:
+	 *
+	 * 1) mem_cgroup_move_account() or
+	 * 2) memcg_reparent_objcgs()
+	 *
+	 * The possible bad scenario would like:
+	 *
+	 * CPU0:                CPU1:                CPU2:
+	 * lruvec = folio_lruvec()
+	 *
+	 *                      if (!isolate_lru_page())
+	 *                              mem_cgroup_move_account()
+	 *
+	 *                                           memcg_reparent_objcgs()
+	 *
+	 * spin_lock(&lruvec->lru_lock)
+	 *                ^^^^^^
+	 *              wrong lock
+	 *
+	 * Either CPU1 or CPU2 can change page memcg, so we need to check
+	 * whether page memcg is changed, if so, we should reacquire the
+	 * new lruvec lock.
+	 */
 	if (unlikely(lruvec_memcg(lruvec) != folio_memcg(folio))) {
 		spin_unlock(&lruvec->lru_lock);
 		goto retry;
 	}
+
+	/*
+	 * When we reach here, it means that the folio_memcg(folio) is
+	 * stable.
+	 */
 	rcu_read_unlock();
 
 	return lruvec;
@@ -1361,6 +1390,7 @@ struct lruvec *folio_lruvec_lock_irq(struct folio *folio)
 	lruvec = folio_lruvec(folio);
 	spin_lock_irq(&lruvec->lru_lock);
 
+	/* See the comments in folio_lruvec_lock(). */
 	if (unlikely(lruvec_memcg(lruvec) != folio_memcg(folio))) {
 		spin_unlock_irq(&lruvec->lru_lock);
 		goto retry;
@@ -1394,6 +1424,7 @@ struct lruvec *folio_lruvec_lock_irqsave(struct folio *folio,
 	lruvec = folio_lruvec(folio);
 	spin_lock_irqsave(&lruvec->lru_lock, *flags);
 
+	/* See the comments in folio_lruvec_lock(). */
 	if (unlikely(lruvec_memcg(lruvec) != folio_memcg(folio))) {
 		spin_unlock_irqrestore(&lruvec->lru_lock, *flags);
 		goto retry;
@@ -5809,7 +5840,10 @@ static int mem_cgroup_move_account(struct page *page,
 	obj_cgroup_put(rcu_dereference(from->objcg));
 	rcu_read_unlock();
 
+	/* See the comments in folio_lruvec_lock(). */
+	spin_lock(&from_vec->lru_lock);
 	folio->memcg_data = (unsigned long)rcu_access_pointer(to->objcg);
+	spin_unlock(&from_vec->lru_lock);
 
 	__folio_memcg_unlock(from);
 
diff --git a/mm/swap.c b/mm/swap.c
index 987dcbd93ffa..0fc59409e27d 100644
--- a/mm/swap.c
+++ b/mm/swap.c
@@ -196,6 +196,7 @@ static void lru_add_fn(struct lruvec *lruvec, struct folio *folio)
 
 	VM_BUG_ON_FOLIO(folio_test_lru(folio), folio);
 
+	folio_set_lru(folio);
 	/*
 	 * Is an smp_mb__after_atomic() still required here, before
 	 * folio_evictable() tests the mlocked flag, to rule out the possibility
@@ -238,14 +239,8 @@ static void folio_batch_move_lru(struct folio_batch *fbatch, move_fn_t move_fn)
 	for (i = 0; i < folio_batch_count(fbatch); i++) {
 		struct folio *folio = fbatch->folios[i];
 
-		/* block memcg migration while the folio moves between lru */
-		if (move_fn != lru_add_fn && !folio_test_clear_lru(folio))
-			continue;
-
 		lruvec = folio_lruvec_relock_irqsave(folio, lruvec, &flags);
 		move_fn(lruvec, folio);
-
-		folio_set_lru(folio);
 	}
 
 	if (lruvec)
@@ -265,7 +260,7 @@ static void folio_batch_add_and_move(struct folio_batch *fbatch,
 
 static void lru_move_tail_fn(struct lruvec *lruvec, struct folio *folio)
 {
-	if (!folio_test_unevictable(folio)) {
+	if (folio_test_lru(folio) && !folio_test_unevictable(folio)) {
 		lruvec_del_folio(lruvec, folio);
 		folio_clear_active(folio);
 		lruvec_add_folio_tail(lruvec, folio);
@@ -348,7 +343,8 @@ void lru_note_cost_folio(struct folio *folio)
 
 static void folio_activate_fn(struct lruvec *lruvec, struct folio *folio)
 {
-	if (!folio_test_active(folio) && !folio_test_unevictable(folio)) {
+	if (folio_test_lru(folio) && !folio_test_active(folio) &&
+	    !folio_test_unevictable(folio)) {
 		long nr_pages = folio_nr_pages(folio);
 
 		lruvec_del_folio(lruvec, folio);
@@ -394,12 +390,9 @@ static void folio_activate(struct folio *folio)
 {
 	struct lruvec *lruvec;
 
-	if (folio_test_clear_lru(folio)) {
-		lruvec = folio_lruvec_lock_irq(folio);
-		folio_activate_fn(lruvec, folio);
-		lruvec_unlock_irq(lruvec);
-		folio_set_lru(folio);
-	}
+	lruvec = folio_lruvec_lock_irq(folio);
+	folio_activate_fn(lruvec, folio);
+	lruvec_unlock_irq(lruvec);
 }
 #endif
 
@@ -542,6 +535,9 @@ static void lru_deactivate_file_fn(struct lruvec *lruvec, struct folio *folio)
 	bool active = folio_test_active(folio);
 	long nr_pages = folio_nr_pages(folio);
 
+	if (!folio_test_lru(folio))
+		return;
+
 	if (folio_test_unevictable(folio))
 		return;
 
@@ -580,7 +576,8 @@ static void lru_deactivate_file_fn(struct lruvec *lruvec, struct folio *folio)
 
 static void lru_deactivate_fn(struct lruvec *lruvec, struct folio *folio)
 {
-	if (folio_test_active(folio) && !folio_test_unevictable(folio)) {
+	if (folio_test_lru(folio) && folio_test_active(folio) &&
+	    !folio_test_unevictable(folio)) {
 		long nr_pages = folio_nr_pages(folio);
 
 		lruvec_del_folio(lruvec, folio);
@@ -596,8 +593,9 @@ static void lru_deactivate_fn(struct lruvec *lruvec, struct folio *folio)
 
 static void lru_lazyfree_fn(struct lruvec *lruvec, struct folio *folio)
 {
-	if (folio_test_anon(folio) && folio_test_swapbacked(folio) &&
-	    !folio_test_swapcache(folio) && !folio_test_unevictable(folio)) {
+	if (folio_test_lru(folio) && folio_test_anon(folio) &&
+	    folio_test_swapbacked(folio) && !folio_test_swapcache(folio) &&
+	    !folio_test_unevictable(folio)) {
 		long nr_pages = folio_nr_pages(folio);
 
 		lruvec_del_folio(lruvec, folio);
diff --git a/mm/vmscan.c b/mm/vmscan.c
index eee1dad7d5b2..d13abb9d7715 100644
--- a/mm/vmscan.c
+++ b/mm/vmscan.c
@@ -4879,18 +4879,15 @@ void check_move_unevictable_folios(struct folio_batch *fbatch)
 
 		pgscanned += nr_pages;
 
-		/* block memcg migration while the folio moves between lrus */
-		if (!folio_test_clear_lru(folio))
-			continue;
-
 		lruvec = folio_lruvec_relock_irq(folio, lruvec);
+		if (!folio_test_lru(folio))
+			continue;
 		if (folio_evictable(folio) && folio_test_unevictable(folio)) {
 			lruvec_del_folio(lruvec, folio);
 			folio_clear_unevictable(folio);
 			lruvec_add_folio(lruvec, folio);
 			pgrescued += nr_pages;
 		}
-		folio_set_lru(folio);
 	}
 
 	if (lruvec) {
-- 
2.11.0


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

* linux-next: manual merge of the mm tree with the folio tree
@ 2022-06-22  5:38 Stephen Rothwell
  2022-06-22  7:22 ` Muchun Song
  0 siblings, 1 reply; 11+ messages in thread
From: Stephen Rothwell @ 2022-06-22  5:38 UTC (permalink / raw)
  To: Andrew Morton, Matthew Wilcox
  Cc: Linux Kernel Mailing List, Linux Next Mailing List, Muchun Song

[-- Attachment #1: Type: text/plain, Size: 1855 bytes --]

Hi all,

Today's linux-next merge of the mm tree got a conflict in:

  mm/vmscan.c

between commit:

  15077be8badc ("vmscan: Add check_move_unevictable_folios()")

from the folio tree and commits:

  cca700a8e695 ("mm: lru: use lruvec lock to serialize memcg changes")

from the mm tree.

I fixed it up (see below) and can carry the fix as necessary. This
is now fixed as far as linux-next is concerned, but any non trivial
conflicts should be mentioned to your upstream maintainer when your tree
is submitted for merging.  You may also want to consider cooperating
with the maintainer of the conflicting tree to minimise any particularly
complex conflicts.

-- 
Cheers,
Stephen Rothwell

diff --cc mm/vmscan.c
index 04f8671caad9,60335f974803..000000000000
--- a/mm/vmscan.c
+++ b/mm/vmscan.c
@@@ -4823,18 -4856,22 +4873,17 @@@ void check_move_unevictable_folios(stru
  	int pgrescued = 0;
  	int i;
  
 -	for (i = 0; i < pvec->nr; i++) {
 -		struct page *page = pvec->pages[i];
 -		struct folio *folio = page_folio(page);
 -		int nr_pages;
 -
 -		if (PageTransTail(page))
 -			continue;
 +	for (i = 0; i < fbatch->nr; i++) {
 +		struct folio *folio = fbatch->folios[i];
 +		int nr_pages = folio_nr_pages(folio);
  
 -		nr_pages = folio_nr_pages(folio);
  		pgscanned += nr_pages;
  
- 		/* block memcg migration while the folio moves between lrus */
- 		if (!folio_test_clear_lru(folio))
+ 		lruvec = folio_lruvec_relock_irq(folio, lruvec);
+ 		if (!folio_test_lru(folio) || !folio_test_unevictable(folio))
  			continue;
  
- 		lruvec = folio_lruvec_relock_irq(folio, lruvec);
- 		if (folio_evictable(folio) && folio_test_unevictable(folio)) {
+ 		if (folio_evictable(folio)) {
  			lruvec_del_folio(lruvec, folio);
  			folio_clear_unevictable(folio);
  			lruvec_add_folio(lruvec, folio);

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

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

* linux-next: manual merge of the mm tree with the folio tree
@ 2022-06-20  3:53 Stephen Rothwell
  0 siblings, 0 replies; 11+ messages in thread
From: Stephen Rothwell @ 2022-06-20  3:53 UTC (permalink / raw)
  To: Andrew Morton, Matthew Wilcox
  Cc: Linux Kernel Mailing List, Linux Next Mailing List

[-- Attachment #1: Type: text/plain, Size: 1534 bytes --]

Hi all,

Today's linux-next merge of the mm tree got a conflict in:

  include/linux/pagevec.h

between commit:

  132a550f50c4 ("filemap: Remove find_get_pages_range() and associated functions")

from the folio tree and commit:

  229d98bdddcb ("mm/swap: make __pagevec_lru_add static")

from the mm tree.

I fixed it up (see below) and can carry the fix as necessary. This
is now fixed as far as linux-next is concerned, but any non trivial
conflicts should be mentioned to your upstream maintainer when your tree
is submitted for merging.  You may also want to consider cooperating
with the maintainer of the conflicting tree to minimise any particularly
complex conflicts.

-- 
Cheers,
Stephen Rothwell

diff --cc include/linux/pagevec.h
index 6649154a2115,b0e3540f3a4c..000000000000
--- a/include/linux/pagevec.h
+++ b/include/linux/pagevec.h
@@@ -26,7 -26,16 +26,6 @@@ struct pagevec 
  };
  
  void __pagevec_release(struct pagevec *pvec);
- void __pagevec_lru_add(struct pagevec *pvec);
 -unsigned pagevec_lookup_range(struct pagevec *pvec,
 -			      struct address_space *mapping,
 -			      pgoff_t *start, pgoff_t end);
 -static inline unsigned pagevec_lookup(struct pagevec *pvec,
 -				      struct address_space *mapping,
 -				      pgoff_t *start)
 -{
 -	return pagevec_lookup_range(pvec, mapping, start, (pgoff_t)-1);
 -}
 -
  unsigned pagevec_lookup_range_tag(struct pagevec *pvec,
  		struct address_space *mapping, pgoff_t *index, pgoff_t end,
  		xa_mark_t tag);

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

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

* linux-next: manual merge of the mm tree with the folio tree
@ 2022-05-03  6:14 Stephen Rothwell
  0 siblings, 0 replies; 11+ messages in thread
From: Stephen Rothwell @ 2022-05-03  6:14 UTC (permalink / raw)
  To: Andrew Morton, Matthew Wilcox
  Cc: Linux Kernel Mailing List, Linux Next Mailing List, NeilBrown

[-- Attachment #1: Type: text/plain, Size: 1170 bytes --]

Hi all,

Today's linux-next merge of the mm tree got a conflict in:

  fs/nfs/file.c

between commit:

  9ac3e82e9ae2 ("nfs: Convert to release_folio")

from the folio tree and commit:

  e1736b007c43 ("VFS: Add FMODE_CAN_ODIRECT file flag")

from the mm tree.

I fixed it up (see below) and can carry the fix as necessary. This
is now fixed as far as linux-next is concerned, but any non trivial
conflicts should be mentioned to your upstream maintainer when your tree
is submitted for merging.  You may also want to consider cooperating
with the maintainer of the conflicting tree to minimise any particularly
complex conflicts.

-- 
Cheers,
Stephen Rothwell

diff --cc fs/nfs/file.c
index d764b3ce7905,bfb4b707b07e..000000000000
--- a/fs/nfs/file.c
+++ b/fs/nfs/file.c
@@@ -522,8 -537,7 +534,7 @@@ const struct address_space_operations n
  	.write_begin = nfs_write_begin,
  	.write_end = nfs_write_end,
  	.invalidate_folio = nfs_invalidate_folio,
 -	.releasepage = nfs_release_page,
 +	.release_folio = nfs_release_folio,
- 	.direct_IO = nfs_direct_IO,
  #ifdef CONFIG_MIGRATION
  	.migratepage = nfs_migrate_page,
  #endif

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

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

* linux-next: manual merge of the mm tree with the folio tree
@ 2022-05-02  9:36 Stephen Rothwell
  0 siblings, 0 replies; 11+ messages in thread
From: Stephen Rothwell @ 2022-05-02  9:36 UTC (permalink / raw)
  To: Andrew Morton, Matthew Wilcox
  Cc: Linux Kernel Mailing List, Linux Next Mailing List, NeilBrown

[-- Attachment #1: Type: text/plain, Size: 857 bytes --]

Hi all,

Today's linux-next merge of the mm tree got a conflict in:

  mm/page_io.c

between commit:

  f6c95ae9b2c7 ("mm: Convert swap_readpage to call read_folio instead of readpage")

from the folio tree and commits:

  152ac2c67212 ("mm: introduce ->swap_rw and use it for reads from SWP_FS_OPS swap-space")
  8272c4afbe68 ("mm: submit multipage reads for SWP_FS_OPS swap-space")

from the mm tree.

I fixed it up (I just dorpped the folio tree change) and can carry the
fix as necessary. This is now fixed as far as linux-next is concerned,
but any non trivial conflicts should be mentioned to your upstream
maintainer when your tree is submitted for merging.  You may also want
to consider cooperating with the maintainer of the conflicting tree to
minimise any particularly complex conflicts.

-- 
Cheers,
Stephen Rothwell

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

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

end of thread, other threads:[~2022-06-23  2:15 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-12  8:26 linux-next: manual merge of the mm tree with the folio tree Stephen Rothwell
2022-05-12 11:52 ` Ryusuke Konishi
2022-05-12 12:51   ` Matthew Wilcox
2022-05-12 16:13     ` Ryusuke Konishi
  -- strict thread matches above, loose matches on Subject: below --
2022-06-22  5:38 Stephen Rothwell
2022-06-22  7:22 ` Muchun Song
2022-06-22 18:59   ` Andrew Morton
2022-06-23  2:15     ` Muchun Song
2022-06-20  3:53 Stephen Rothwell
2022-05-03  6:14 Stephen Rothwell
2022-05-02  9:36 Stephen Rothwell

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).