Re: [PATCH] ipc: Convert ipcs_idr to XArray

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sat, Apr 18, 2020 at 01:15:09PM -0700, Andrew Morton wrote:
> > --- 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/?

"grew a few"?  I added (this) one and deleted two others.  From in the
middle of functions, like we usually prefer.

I mean, this is why we need something like this:

@@ -17,11 +17,11 @@ struct ipc_ids {
...
 #ifdef CONFIG_CHECKPOINT_RESTORE
-       int next_id;
+       int restore_id;
 #endif

> > +#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?

Would you rather see it done as:

static inline void set_restore_id(struct ipc_ids *ids, int id)
{
#ifdef CONFIG_CHECKPOINT_RESTORE
	ids->restore_id = id;
#endif
}

static inline int get_restore_id(struct ipc_ids *ids)
{
#ifdef CONFIG_CHECKPOINT_RESTORE
	return ids->restore_id;
#else
	return -1;
#endif
}



[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [Samba]     [Device Mapper]     [CEPH Development]

  Powered by Linux