|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Minios-devel] [UNIKRAFT PATCH] lib/alloc: check for missing palloc implementation
Hi Simon,
On Wed, 2020-01-08 at 13:40 +0100, Simon Kuenzer wrote:
> <snip>
> > static inline void *uk_palloc(struct uk_alloc *a, size_t order)
> > {
> > - if (unlikely(!a))
> > + if (unlikely(!a) || unlikely(!a->palloc))
> Interesting... I am actually curious what the compiler does with
> your
> condition. I would have written it with just one encapsulating
> `unlikely` hint:
>
> if (unlikely(!a || !a->palloc))
>
> Maybe there is no difference and it turns out to be different coding
> style. In general, having just one encapsulating hint maybe easier to
> read.
>
> What do you think?
unlikely(!a) || unlikely(!a->palloc)
and
unlikely(!a || !a->palloc)
seem to result in the same binary, but the difference is unclear to me.
Anyways, let's opt for `unlikely(!a || !a->palloc)`, it looks better.
thanks!
cheers,
Hugo
_______________________________________________
Minios-devel mailing list
Minios-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/minios-devel
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |