linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Matthew Wilcox <willy@infradead.org>
To: akpm@linux-foundation.org
Cc: mm-commits@vger.kernel.org, songliubraving@fb.com,
	kirill@shutemov.name, cai@lca.pw, linux-mm@kvack.org
Subject: Re: + xarray-add-xas_split-fix.patch added to -mm tree
Date: Tue, 8 Sep 2020 23:06:44 +0100	[thread overview]
Message-ID: <20200908220644.GA6583@casper.infradead.org> (raw)
In-Reply-To: <20200904172353.gfJQP%akpm@linux-foundation.org>

On Fri, Sep 04, 2020 at 10:23:53AM -0700, akpm@linux-foundation.org wrote:
> From: Andrew Morton <akpm@linux-foundation.org>
> Subject: xarray-add-xas_split-fix

Can I ask you to add another -fix patch?

In my testing, I found that splitting a THP that was of order 6 or higher
meant that marking it as dirty no longer worked.  It was pretty weird.
I figured out that what I was doing was setting all the mark bits in the
new child node unconditionally (instead of only if the split entry was
marked).  Once the mark bits were set in the node, calling xa_set_mark()
no longer works because it sees the leaf of the tree is already marked,
and so it does not walk up the tree to set the mark on the parents.
And thus the call to xa_get_mark() never walks _down_ to see the child
is marked.

It doesn't affect your tree because it's only used for read-only pages,
but in my tree it causes failures once I induce splitting to happen
more frequently.

I've included an update to the test-suite which ensures this doesn't
happen again (if you apply just the test suite update, it'll cause
failures in the test suite).

From edcd692083586b2b218ce3d935429a2349969ba9 Mon Sep 17 00:00:00 2001
From: "Matthew Wilcox (Oracle)" <willy@infradead.org>
Date: Tue, 8 Sep 2020 17:55:22 -0400
Subject: [PATCH] fix xarray split

---
 lib/test_xarray.c | 3 +++
 lib/xarray.c      | 7 ++++---
 2 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/lib/test_xarray.c b/lib/test_xarray.c
index 37f7fed3e982..4115979cc716 100644
--- a/lib/test_xarray.c
+++ b/lib/test_xarray.c
@@ -1546,6 +1546,9 @@ static void check_split_1(struct xarray *xa, unsigned long index,
 	}
 	XA_BUG_ON(xa, i != 1 << order);
 
+	xa_set_mark(xa, index, XA_MARK_0);
+	XA_BUG_ON(xa, !xa_get_mark(xa, index, XA_MARK_0));
+
 	xa_destroy(xa);
 }
 
diff --git a/lib/xarray.c b/lib/xarray.c
index 53045e14ad22..9180a7d48315 100644
--- a/lib/xarray.c
+++ b/lib/xarray.c
@@ -973,10 +973,11 @@ static void node_set_marks(struct xa_node *node, unsigned int offset,
 	xa_mark_t mark = XA_MARK_0;
 
 	for (;;) {
-		if (marks & (1 << (__force unsigned int)mark))
+		if (marks & (1 << (__force unsigned int)mark)) {
 			node_set_mark(node, offset, mark);
-		if (child)
-			node_mark_all(child, mark);
+			if (child)
+				node_mark_all(child, mark);
+		}
 		if (mark == XA_MARK_MAX)
 			break;
 		mark_inc(mark);
-- 
2.28.0



       reply	other threads:[~2020-09-08 22:06 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20200904172353.gfJQP%akpm@linux-foundation.org>
2020-09-08 22:06 ` Matthew Wilcox [this message]
2020-09-10 17:54   ` Matthew Wilcox

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200908220644.GA6583@casper.infradead.org \
    --to=willy@infradead.org \
    --cc=akpm@linux-foundation.org \
    --cc=cai@lca.pw \
    --cc=kirill@shutemov.name \
    --cc=linux-mm@kvack.org \
    --cc=mm-commits@vger.kernel.org \
    --cc=songliubraving@fb.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox