Re: [PATCH] ipc: Convert ipcs_idr to XArray

From: Andrew Morton
Date: Sat Apr 18 2020 - 16:15:13 EST


On Thu, 26 Mar 2020 08:14:18 -0700 Matthew Wilcox <willy@xxxxxxxxxxxxx> wrote:

> From: "Matthew Wilcox (Oracle)" <willy@xxxxxxxxxxxxx>
>
> The XArray has better loops than the IDR has, removing the need to
> open-code them. We also don't need to call idr_destroy() any more.
> Allocating the ID is a little tricky due to needing to get 'seq'
> correct. Open-code a variant of __xa_alloc() which lets us set the
> ID and the seq before depositing the pointer in the array.

hm, this goes rather deep. Manfred & Davidlohr, are you able to run
this through some testing?

>
> ...
>
> --- a/ipc/util.c
> +++ b/ipc/util.c
> @@ -104,12 +104,20 @@ static const struct rhashtable_params ipc_kht_params = {
> .automatic_shrinking = true,
> };
>
> +#ifdef CONFIG_CHECKPOINT_RESTORE

The code grew a few additional CONFIG_CHECKPOINT_RESTORE ifdefs.
What's going on here? Why is CRIU special in ipc/?

> +#define set_restore_id(ids, x) ids->restore_id = x
> +#define get_restore_id(ids) ids->restore_id
> +#else
> +#define set_restore_id(ids, x) do { } while (0)
> +#define get_restore_id(ids) (-1)
> +#endif

Well these are ugly. Can't all this be done in C?

>
> ...
>