2019-01-29 11:09:20

by Li RongQing

[permalink] [raw]
Subject: [PATCH] XArray tests: allocation has to be GFP_ATOMIC under rcu_read_lock

Signed-off-by: Li RongQing <[email protected]>
---
lib/test_xarray.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/test_xarray.c b/lib/test_xarray.c
index c596a957f764..5b671c83b73d 100644
--- a/lib/test_xarray.c
+++ b/lib/test_xarray.c
@@ -108,7 +108,7 @@ static noinline void check_xas_retry(struct xarray *xa)
XA_BUG_ON(xa, xas_next_entry(&xas, ULONG_MAX) != xa_mk_value(0));
XA_BUG_ON(xa, xas.xa_node != NULL);

- XA_BUG_ON(xa, xa_store_index(xa, 1, GFP_KERNEL) != NULL);
+ XA_BUG_ON(xa, xa_store_index(xa, 1, GFP_ATOMIC) != NULL);
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));
--
2.16.2



2019-02-02 23:20:22

by Matthew Wilcox

[permalink] [raw]
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));


2019-02-11 04:12:44

by Li RongQing

[permalink] [raw]
Subject: 答复: [PATCH] XArray tests: allocation has to be GFP_ATOMIC under rcu_read_lock



> -----?ʼ?ԭ??-----
> ??????: Matthew Wilcox [mailto:[email protected]]
> ????ʱ??: 2019??2??3?? 7:20
> ?ռ???: Li,Rongqing <[email protected]>
> ????: [email protected]
> ????: 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:
>

Could you send this patch?

Thanks

-Li RongQing


> +++ 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));

2019-02-11 04:19:36

by Matthew Wilcox

[permalink] [raw]
Subject: Re: 答复: [PATCH] XArra y tests: allocation has to be GFP_ATOMIC under rcu_read_lock

On Mon, Feb 11, 2019 at 03:55:53AM +0000, Li,Rongqing wrote:
> Could you send this patch?

I put it in
http://git.infradead.org/users/willy/linux-dax.git/shortlog/refs/heads/xarray
which is included in linux-next.