Page MenuHomeFreeBSD

umtx: Add bitset member to the struct umtx_q.
ClosedPublic

Authored by dchagin on Jul 20 2021, 2:09 PM.

Details

Summary

Bitset is a Linux emulation layer extension. This 32-bit mask, in which at least
one bit must be set, is used to select which threads should be woken up.

Diff Detail

Repository
R10 FreeBSD src repository
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

sys/kern/kern_umtx.c
572

Why is it hard-coded to SHARED_QUEUE?

sys/sys/umtxvar.h
122–125

There is a hole here on LP64, if you add the new field here the size of the structure will not grow.

sys/kern/kern_umtx.c
572

EXCLUSIVE_QUEUE used only by rw_lock, many umtx functions hide queue, umtxq_insert/umtxq_remove pair for example

sys/sys/umtxvar.h
122–125

good, thanks, will fix it

sys/kern/kern_umtx.c
573
if (uf == NULL)
  return (0);

Then decrease indent level by one.

574

I do not know the intent, but what if there is a hole in the queue WRT bitmask? I mean, e.g. if we have thee elements with the uq_bitset values 1, 2, 4, and bitset is 5. Then you miss the element 4.

sys/sys/umtxvar.h
123

If the field is 32bit mask, then might be uint32_t type is better? It is explicit.

whoops, perhaps I fixed it

This revision is now accepted and ready to land.Jul 21 2021, 7:20 PM