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

From: Li,Rongqing
Date: Sun Feb 10 2019 - 23:11:51 EST




> -----邮件原件-----
> 发件人: Matthew Wilcox [mailto:willy@xxxxxxxxxxxxx]
> 发送时间: 2019年2月3日 7:20
> 收件人: Li,Rongqing <lirongqing@xxxxxxxxx>
> 抄送: linux-kernel@xxxxxxxxxxxxxxx
> 主题: 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));