Re: Hang in FUTEX_WAKE_PRIVATE after clock_gettime

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

 



On Sat, 24 Mar 2018 04:43:42 -0400, Jeffrey Walton said:

> My question is, is a futex with a 2147483647 or -1 expected? Where
> should I be looking to begin to narrow the problem down?

'man 7 futex' says:

   Semantics
       Any futex operation starts in user space, but it may  be  necessary  to
       communicate with the kernel using the futex(2) system call.

       To  "up"  a  futex, execute the proper assembler instructions that will
       cause the host CPU to atomically  increment  the  integer.   Afterward,
       check  if  it has in fact changed from 0 to 1, in which case there were
       no waiters and the operation is done.  This is  the  noncontended  case
       which is fast and should be common.

       In the contended case, the atomic increment changed the counter from -1
       (or some other negative number).  If this is detected, there are  wait-
       ers.   User space should now set the counter to 1 and instruct the ker-
       nel to wake up any waiters using the FUTEX_WAKE operation.

       Waiting on a futex, to "down" it, is the reverse operation.  Atomically
       decrement  the  counter and check if it changed to 0, in which case the
       operation is done and the futex was uncontended.  In all other  circum-
       stances,  the process should set the counter to -1 and request that the
       kernel wait for another process to up the futex.  This  is  done  using
       the FUTEX_WAIT operation.

       The  futex(2) system call can optionally be passed a timeout specifying
       how long the kernel should wait for the futex to  be  upped.   In  this
       case,  semantics  are  more  complex  and the programmer is referred to
       futex(2) for more details.  The same holds for asynchronous futex waiting.

which pretty much says that a negative value means there's somebody waiting
on the futex.

Attachment: pgpQpreBU3F4A.pgp
Description: PGP signature

_______________________________________________
Kernelnewbies mailing list
Kernelnewbies@xxxxxxxxxxxxxxxxx
https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies

[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]

  Powered by Linux