[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Sat, 2 Feb 2019 15:19:44 -0800
From: Matthew Wilcox <willy@...radead.org>
To: Li RongQing <lirongqing@...du.com>
Cc: linux-kernel@...r.kernel.org
Subject: Re: [PATCH] XArray tests: allocation has to be GFP_ATOMIC under
rcu_read_lock
On Tue, Jan 29, 2019 at 07:08:42PM +0800, Li RongQing wrote:
> - XA_BUG_ON(xa, xa_store_index(xa, 1, GFP_KERNEL) != NULL);
> + XA_BUG_ON(xa, xa_store_index(xa, 1, GFP_ATOMIC) != NULL);
Did you try running this change in userspace too? I don't think it'll
work.
I think the right change would be:
+++ b/lib/test_xarray.c
@@ -107,8 +107,11 @@ static noinline void check_xas_retry(struct xarray *xa)
XA_BUG_ON(xa, xas.xa_node != XAS_RESTART);
XA_BUG_ON(xa, xas_next_entry(&xas, ULONG_MAX) != xa_mk_value(0));
XA_BUG_ON(xa, xas.xa_node != NULL);
+ rcu_read_unlock();
XA_BUG_ON(xa, xa_store_index(xa, 1, GFP_KERNEL) != NULL);
+
+ rcu_read_lock();
XA_BUG_ON(xa, !xa_is_internal(xas_reload(&xas)));
xas.xa_node = XAS_RESTART;
XA_BUG_ON(xa, xas_next_entry(&xas, ULONG_MAX) != xa_mk_value(0));
Powered by blists - more mailing lists