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: Thu, 10 Sep 2020 18:54:50 +0100 [thread overview]
Message-ID: <20200910175450.GV6583@casper.infradead.org> (raw)
In-Reply-To: <20200908220644.GA6583@casper.infradead.org>
On Tue, Sep 08, 2020 at 11:06:44PM +0100, Matthew Wilcox wrote:
> 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?
... updated to also fix the documentation. Thanks, Mauro.
commit 71c3da6f580dc6ce98143d92da768c85638d4518
Author: Matthew Wilcox (Oracle) <willy@infradead.org>
Date: Tue Sep 8 17:55:22 2020 -0400
fix xarray split
diff --git a/lib/test_xarray.c b/lib/test_xarray.c
index 16fe5adcac62..8262c3f05a5d 100644
--- a/lib/test_xarray.c
+++ b/lib/test_xarray.c
@@ -1524,6 +1524,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 ff3652657bd8..b573db455c43 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);
@@ -984,8 +985,18 @@ static void node_set_marks(struct xa_node *node, unsigned int offset,
}
/**
- * Allocate memory for splitting an entry of @order size into the order
- * stored in the @xas.
+ * xas_split_alloc() - Allocate memory for splitting an entry.
+ * @xas: XArray operation state.
+ * @entry: New entry which will be stored in the array.
+ * @order: New entry order.
+ * @gfp: Memory allocation flags.
+ *
+ * This function should be called before calling xas_split().
+ * If necessary, it will allocate new nodes (and fill them with @entry)
+ * to prepare for the upcoming split of an entry of @order size into
+ * entries of the order stored in the @xas.
+ *
+ * Context: May sleep if @gfp flags permit.
*/
void xas_split_alloc(struct xa_state *xas, void *entry, unsigned int order,
gfp_t gfp)
prev parent reply other threads:[~2020-09-10 17:55 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
2020-09-10 17:54 ` Matthew Wilcox [this message]
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=20200910175450.GV6583@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