)]}'
{
  "log": [
    {
      "commit": "f579bbcd9bb8b688df03191b92c56ab8af4d6322",
      "tree": "d450f986022aab73f86f794a03c7f21ad0ece8ec",
      "parents": [
        "e80fb7e52fd305b916a671755ca31ecf8f92e94e",
        "da085681014fb43d67d9bf6d14bc068e9254bd49"
      ],
      "author": {
        "name": "Linus Torvalds",
        "email": "torvalds@linux-foundation.org",
        "time": "Thu Oct 08 12:16:35 2009 -0700"
      },
      "committer": {
        "name": "Linus Torvalds",
        "email": "torvalds@linux-foundation.org",
        "time": "Thu Oct 08 12:16:35 2009 -0700"
      },
      "message": "Merge branch \u0027core-fixes-for-linus\u0027 of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip\n\n* \u0027core-fixes-for-linus\u0027 of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip:\n  futex: fix requeue_pi key imbalance\n  futex: Fix typo in FUTEX_WAIT/WAKE_BITSET_PRIVATE definitions\n  rcu: Place root rcu_node structure in separate lockdep class\n  rcu: Make hot-unplugged CPU relinquish its own RCU callbacks\n  rcu: Move rcu_barrier() to rcutree\n  futex: Move exit_pi_state() call to release_mm()\n  futex: Nullify robust lists after cleanup\n  futex: Fix locking imbalance\n  panic: Fix panic message visibility by calling bust_spinlocks(0) before dying\n  rcu: Replace the rcu_barrier enum with pointer to call_rcu*() function\n  rcu: Clean up code based on review feedback from Josh Triplett, part 4\n  rcu: Clean up code based on review feedback from Josh Triplett, part 3\n  rcu: Fix rcu_lock_map build failure on CONFIG_PROVE_LOCKING\u003dy\n  rcu: Clean up code to address Ingo\u0027s checkpatch feedback\n  rcu: Clean up code based on review feedback from Josh Triplett, part 2\n  rcu: Clean up code based on review feedback from Josh Triplett\n"
    },
    {
      "commit": "f8d1e548931cfa5ea9a082e020c2a47d27e5d793",
      "tree": "011386ec75dba2fd16ea6f20b9fccce4c18af6b6",
      "parents": [
        "978c0b88146a7f9b364b71b5b83c5b12e7b413d7"
      ],
      "author": {
        "name": "Anton Blanchard",
        "email": "anton@samba.org",
        "time": "Wed Oct 07 11:13:58 2009 +1100"
      },
      "committer": {
        "name": "Thomas Gleixner",
        "email": "tglx@linutronix.de",
        "time": "Wed Oct 07 12:26:55 2009 +0200"
      },
      "message": "futex: Fix typo in FUTEX_WAIT/WAKE_BITSET_PRIVATE definitions\n\nLooks like a typo, FUTEX_WAKE_BITS should be FUTEX_WAIT_BITSET.\n\nSigned-off-by: Anton Blanchard \u003canton@samba.org\u003e\nLKML-Reference: \u003c20091007001358.GE16073@kryten\u003e\nSigned-off-by: Thomas Gleixner \u003ctglx@linutronix.de\u003e\n"
    },
    {
      "commit": "9064a6787aa1d8ceaf5ba16fe1dfedb0755dc7eb",
      "tree": "9d9e556b736a5e91edfddaebd478d453a2392b81",
      "parents": [
        "e5a4738699d6eca408dcb225bd350413927701e2"
      ],
      "author": {
        "name": "Mike Frysinger",
        "email": "vapier@gentoo.org",
        "time": "Wed Sep 23 15:57:23 2009 -0700"
      },
      "committer": {
        "name": "Linus Torvalds",
        "email": "torvalds@linux-foundation.org",
        "time": "Thu Sep 24 07:21:04 2009 -0700"
      },
      "message": "linux/futex.h: place kernel types behind __KERNEL__\n\nThe forward decls for some kernel types are only needed by the code behind\n__KERNEL__, so don\u0027t bleed these types to userspace.\n\nSigned-off-by: Mike Frysinger \u003cvapier@gentoo.org\u003e\nCc: Thomas Gleixner \u003ctglx@linutronix.de\u003e\nCc: Ingo Molnar \u003cmingo@elte.hu\u003e\nSigned-off-by: Andrew Morton \u003cakpm@linux-foundation.org\u003e\nSigned-off-by: Linus Torvalds \u003ctorvalds@linux-foundation.org\u003e\n"
    },
    {
      "commit": "ba9c22f2c01cf5c88beed5a6b9e07d42e10bd358",
      "tree": "77664171b51bb6b03eac13ee946b6d894b2da01d",
      "parents": [
        "a5a2a0c7fa039c59619bc908b3b1ed24734d442a"
      ],
      "author": {
        "name": "Darren Hart",
        "email": "dvhltc@us.ibm.com",
        "time": "Mon Apr 20 22:22:22 2009 -0700"
      },
      "committer": {
        "name": "Thomas Gleixner",
        "email": "tglx@linutronix.de",
        "time": "Thu Apr 30 11:41:35 2009 +0200"
      },
      "message": "futex: remove FUTEX_REQUEUE_PI (non CMP)\n\nThe new requeue PI futex op codes were modeled after the existing\nFUTEX_REQUEUE and FUTEX_CMP_REQUEUE calls.  I was unaware at the time\nthat FUTEX_REQUEUE was only around for compatibility reasons and\nshouldn\u0027t be used in new code.  Ulrich Drepper elaborates on this in his\nFutexes are Tricky paper: http://people.redhat.com/drepper/futex.pdf.\nThe deprecated call doesn\u0027t catch changes to the futex corresponding to\nthe destination futex which can lead to deadlock.\n\nTherefor, I feel it best to remove FUTEX_REQUEUE_PI and leave only\nFUTEX_CMP_REQUEUE_PI as there are not yet any existing users of the API.\nThis patch does change the OP code value of FUTEX_CMP_REQUEUE_PI to 12\nfrom 13.  Since my test case is the only known user of this API, I felt\nthis was the right thing to do, rather than leave a hole in the\nenumeration.\n\nI chose to continue using the _CMP_ modifier in the OP code to make it\nexplicit to the user that the test is being done.\n\nBuilds, boots, and ran several hundred iterations requeue_pi.c.\n\nSigned-off-by: Darren Hart \u003cdvhltc@us.ibm.com\u003e\nLKML-Reference: \u003c49ED580E.1050502@us.ibm.com\u003e\nSigned-off-by: Thomas Gleixner \u003ctglx@linutronix.de\u003e\n"
    },
    {
      "commit": "52400ba946759af28442dee6265c5c0180ac7122",
      "tree": "4c9abe885b3cae3cb47b33826b3c5838fc9761b7",
      "parents": [
        "f801073f87aa22ddf0e9146355fec3993163790f"
      ],
      "author": {
        "name": "Darren Hart",
        "email": "dvhltc@us.ibm.com",
        "time": "Fri Apr 03 13:40:49 2009 -0700"
      },
      "committer": {
        "name": "Thomas Gleixner",
        "email": "tglx@linutronix.de",
        "time": "Mon Apr 06 11:14:03 2009 +0200"
      },
      "message": "futex: add requeue_pi functionality\n\nPI Futexes and their underlying rt_mutex cannot be left ownerless if\nthere are pending waiters as this will break the PI boosting logic, so\nthe standard requeue commands aren\u0027t sufficient.  The new commands\nproperly manage pi futex ownership by ensuring a futex with waiters\nhas an owner at all times.  This will allow glibc to properly handle\npi mutexes with pthread_condvars.\n\nThe approach taken here is to create two new futex op codes:\n\nFUTEX_WAIT_REQUEUE_PI:\nTasks will use this op code to wait on a futex (such as a non-pi waitqueue)\nand wake after they have been requeued to a pi futex.  Prior to returning to\nuserspace, they will acquire this pi futex (and the underlying rt_mutex).\n\nfutex_wait_requeue_pi() is the result of a high speed collision between\nfutex_wait() and futex_lock_pi() (with the first part of futex_lock_pi() being\ndone by futex_proxy_trylock_atomic() on behalf of the top_waiter).\n\nFUTEX_REQUEUE_PI (and FUTEX_CMP_REQUEUE_PI):\nThis call must be used to wake tasks waiting with FUTEX_WAIT_REQUEUE_PI,\nregardless of how many tasks the caller intends to wake or requeue.\npthread_cond_broadcast() should call this with nr_wake\u003d1 and\nnr_requeue\u003dINT_MAX.  pthread_cond_signal() should call this with nr_wake\u003d1 and\nnr_requeue\u003d0.  The reason being we need both callers to get the benefit of the\nfutex_proxy_trylock_atomic() routine.  futex_requeue() also enqueues the\ntop_waiter on the rt_mutex via rt_mutex_start_proxy_lock().\n\nSigned-off-by: Darren Hart \u003cdvhltc@us.ibm.com\u003e\nReviewed-by: Thomas Gleixner \u003ctglx@linutronix.de\u003e\nSigned-off-by: Thomas Gleixner \u003ctglx@linutronix.de\u003e\n"
    },
    {
      "commit": "1acdac104668a0834cfa267de9946fac7764d486",
      "tree": "bae8ffeb2425412c0bffbdf728b45104fe3178f2",
      "parents": [
        "3e1d7a6219ab64e13b10b1a77c0625db9a8bd8db"
      ],
      "author": {
        "name": "Thomas Gleixner",
        "email": "tglx@linutronix.de",
        "time": "Thu Nov 20 10:02:53 2008 -0800"
      },
      "committer": {
        "name": "Thomas Gleixner",
        "email": "tglx@linutronix.de",
        "time": "Mon Nov 24 20:00:40 2008 +0100"
      },
      "message": "futex: make clock selectable for FUTEX_WAIT_BITSET\n\nFUTEX_WAIT_BITSET could be used instead of FUTEX_WAIT by setting the\nbit set to FUTEX_BITSET_MATCH_ANY, but FUTEX_WAIT uses CLOCK_REALTIME\nwhile FUTEX_WAIT_BITSET uses CLOCK_MONOTONIC.\n\nAdd a flag to select CLOCK_REALTIME for FUTEX_WAIT_BITSET so glibc can\nreplace the FUTEX_WAIT logic which needs to do gettimeofday() calls\nbefore and after the syscall to convert the absolute timeout to a\nrelative timeout for FUTEX_WAIT.\n\nSigned-off-by: Thomas Gleixner \u003ctglx@linutronix.de\u003e\nCc: Ulrich Drepper \u003cdrepper@redhat.com\u003e\n\n"
    },
    {
      "commit": "38d47c1b7075bd7ec3881141bb3629da58f88dab",
      "tree": "44c6ddc753738e69c908706a6b0cad04a7b59f95",
      "parents": [
        "94aca1dac6f6d21f4b07e4864baf7768cabcc6e7"
      ],
      "author": {
        "name": "Peter Zijlstra",
        "email": "a.p.zijlstra@chello.nl",
        "time": "Fri Sep 26 19:32:20 2008 +0200"
      },
      "committer": {
        "name": "Ingo Molnar",
        "email": "mingo@elte.hu",
        "time": "Tue Sep 30 12:35:20 2008 +0200"
      },
      "message": "futex: rely on get_user_pages() for shared futexes\n\nOn the way of getting rid of the mmap_sem requirement for shared futexes,\nstart by relying on get_user_pages().\n\nSigned-off-by: Peter Zijlstra \u003ca.p.zijlstra@chello.nl\u003e\nAcked-by: Nick Piggin \u003cnickpiggin@yahoo.com.au\u003e\nSigned-off-by: Ingo Molnar \u003cmingo@elte.hu\u003e\n"
    },
    {
      "commit": "a0c1e9073ef7428a14309cba010633a6cd6719ea",
      "tree": "05ce792ddcde92e73d1bae4c8e20f607a2e7db40",
      "parents": [
        "3e4ab747efa8e78562ec6782b08bbf21a00aba1b"
      ],
      "author": {
        "name": "Thomas Gleixner",
        "email": "tglx@linutronix.de",
        "time": "Sat Feb 23 15:23:57 2008 -0800"
      },
      "committer": {
        "name": "Linus Torvalds",
        "email": "torvalds@woody.linux-foundation.org",
        "time": "Sat Feb 23 17:12:15 2008 -0800"
      },
      "message": "futex: runtime enable pi and robust functionality\n\nNot all architectures implement futex_atomic_cmpxchg_inatomic().  The default\nimplementation returns -ENOSYS, which is currently not handled inside of the\nfutex guts.\n\nFutex PI calls and robust list exits with a held futex result in an endless\nloop in the futex code on architectures which have no support.\n\nFixing up every place where futex_atomic_cmpxchg_inatomic() is called would\nadd a fair amount of extra if/else constructs to the already complex code.  It\nis also not possible to disable the robust feature before user space tries to\nregister robust lists.\n\nCompile time disabling is not a good idea either, as there are already\narchitectures with runtime detection of futex_atomic_cmpxchg_inatomic support.\n\nDetect the functionality at runtime instead by calling\ncmpxchg_futex_value_locked() with a NULL pointer from the futex initialization\ncode.  This is guaranteed to fail, but the call of\nfutex_atomic_cmpxchg_inatomic() happens with pagefaults disabled.\n\nOn architectures, which use the asm-generic implementation or have a runtime\nCPU feature detection, a -ENOSYS return value disables the PI/robust features.\n\nOn architectures with a working implementation the call returns -EFAULT and\nthe PI/robust features are enabled.\n\nThe relevant syscalls return -ENOSYS and the robust list exit code is blocked,\nwhen the detection fails.\n\nFixes http://lkml.org/lkml/2008/2/11/149\nOriginally reported by: Lennart Buytenhek\n\nSigned-off-by: Thomas Gleixner \u003ctglx@linutronix.de\u003e\nAcked-by: Ingo Molnar \u003cmingo@elte.hu\u003e\nCc: Lennert Buytenhek \u003cbuytenh@wantstofly.org\u003e\nCc: Riku Voipio \u003criku.voipio@movial.fi\u003e\nCc: \u003cstable@kernel.org\u003e\nSigned-off-by: Andrew Morton \u003cakpm@linux-foundation.org\u003e\nSigned-off-by: Linus Torvalds \u003ctorvalds@linux-foundation.org\u003e\n"
    },
    {
      "commit": "cd689985cf49f6ff5c8eddc48d98b9d581d9475d",
      "tree": "a1a119402f5208c45c21b855e8d2fbbaf18cfd72",
      "parents": [
        "83e96c604e781098a2f61b8a294919bcf3abfab4"
      ],
      "author": {
        "name": "Thomas Gleixner",
        "email": "tglx@linutronix.de",
        "time": "Fri Feb 01 17:45:14 2008 +0100"
      },
      "committer": {
        "name": "Ingo Molnar",
        "email": "mingo@elte.hu",
        "time": "Fri Feb 01 17:45:14 2008 +0100"
      },
      "message": "futex: Add bitset conditional wait/wakeup functionality\n\nTo allow the implementation of optimized rw-locks in user space, glibc\nneeds a possibility to select waiters for wakeup depending on a bitset\nmask.\n\nThis requires two new futex OPs: FUTEX_WAIT_BITS and FUTEX_WAKE_BITS\nThese OPs are basically the same as FUTEX_WAIT and FUTEX_WAKE plus an\nadditional argument - a bitset. Further the FUTEX_WAIT_BITS OP is\nexpecting an absolute timeout value instead of the relative one, which\nis used for the FUTEX_WAIT OP.\n\nFUTEX_WAIT_BITS calls into the kernel with a bitset. The bitset is\nstored in the futex_q structure, which is used to enqueue the waiter\ninto the hashed futex waitqueue.\n\nFUTEX_WAKE_BITS also calls into the kernel with a bitset. The wakeup\nfunction logically ANDs the bitset with the bitset stored in each\nwaiters futex_q structure. If the result is zero (i.e. none of the set\nbits in the bitsets is matching), then the waiter is not woken up. If\nthe result is not zero (i.e. one of the set bits in the bitsets is\nmatching), then the waiter is woken.\n\nThe bitset provided by the caller must be non zero. In case the\nprovided bitset is zero the kernel returns EINVAL.\n\nInternaly the new OPs are only extensions to the existing FUTEX_WAIT\nand FUTEX_WAKE functions. The existing OPs hand a bitset with all bits\nset into the futex_wait() and futex_wake() functions.\n\nSigned-off-by: Thomas Gleixner \u003ctgxl@linutronix.de\u003e\nSigned-off-by: Ingo Molnar \u003cmingo@elte.hu\u003e\n"
    },
    {
      "commit": "286100a6cf1c1f692e5f81d14b364ff12b7662f5",
      "tree": "00a6d3530bddfd522e89154ba7a6a75f7fb83932",
      "parents": [
        "5973e5b954848c63855a357ad4ff39882e3904f7"
      ],
      "author": {
        "name": "Alexey Dobriyan",
        "email": "adobriyan@gmail.com",
        "time": "Fri Jan 25 21:08:34 2008 +0100"
      },
      "committer": {
        "name": "Ingo Molnar",
        "email": "mingo@elte.hu",
        "time": "Fri Jan 25 21:08:34 2008 +0100"
      },
      "message": "sched, futex: detach sched.h and futex.h\n\nSigned-off-by: Alexey Dobriyan \u003cadobriyan@gmail.com\u003e\nSigned-off-by: Ingo Molnar \u003cmingo@elte.hu\u003e\n"
    },
    {
      "commit": "fad23fc78b959dae89768e523c3a6f5edb83bbe9",
      "tree": "b4a5f9844b5d2c412a92c528a84ce9cf6d2299da",
      "parents": [
        "02c3530da6b926b31f89ba589da72eca49557edd"
      ],
      "author": {
        "name": "Adrian Bunk",
        "email": "bunk@kernel.org",
        "time": "Fri Nov 02 16:43:22 2007 +0100"
      },
      "committer": {
        "name": "Rusty Russell",
        "email": "rusty@rustcorp.com.au",
        "time": "Mon Nov 05 21:53:46 2007 +1100"
      },
      "message": "kernel/futex.c: make 3 functions static\n\nThe following functions can now become static again:\n- get_futex_key()\n- get_futex_key_refs()\n- drop_futex_key_refs()\n\nSigned-off-by: Adrian Bunk \u003cbunk@kernel.org\u003e\nSigned-off-by: Rusty Russell \u003crusty@rustcorp.com.au\u003e\n"
    },
    {
      "commit": "bd197234b0a616c8f04f6b682326a5a24b33ca92",
      "tree": "1c31f8934b0d5472c9038c042ff27d08b52ffdc6",
      "parents": [
        "188e1f81ba31af1b65a2f3611df4c670b092bbac"
      ],
      "author": {
        "name": "Thomas Gleixner",
        "email": "tglx@linutronix.de",
        "time": "Sun Jun 17 21:11:10 2007 +0200"
      },
      "committer": {
        "name": "Linus Torvalds",
        "email": "torvalds@woody.linux-foundation.org",
        "time": "Mon Jun 18 09:48:41 2007 -0700"
      },
      "message": "Revert \"futex_requeue_pi optimization\"\n\nThis reverts commit d0aa7a70bf03b9de9e995ab272293be1f7937822.\n\nIt not only introduced user space visible changes to the futex syscall,\nit is also non-functional and there is no way to fix it proper before\nthe 2.6.22 release.\n\nThe breakage report ( http://lkml.org/lkml/2007/5/12/17 ) went\nunanswered, and unfortunately it turned out that the concept is not\nfeasible at all.  It violates the rtmutex semantics badly by introducing\na virtual owner, which hacks around the coupling of the user-space\npi_futex and the kernel internal rt_mutex representation.\n\nAt the moment the only safe option is to remove it fully as it contains\nuser-space visible changes to broken kernel code, which we do not want\nto expose in the 2.6.22 release.\n\nThe patch reverts the original patch mostly 1:1, but contains a couple\nof trivial manual cleanups which were necessary due to patches, which\ntouched the same area of code later.\n\nVerified against the glibc tests and my own PI futex tests.\n\nSigned-off-by: Thomas Gleixner \u003ctglx@linutronix.de\u003e\nAcked-by: Ingo Molnar \u003cmingo@elte.hu\u003e\nAcked-by: Ulrich Drepper \u003cdrepper@redhat.com\u003e\nCc: Pierre Peiffer \u003cpierre.peiffer@bull.net\u003e\nSigned-off-by: Linus Torvalds \u003ctorvalds@linux-foundation.org\u003e\n"
    },
    {
      "commit": "34f01cc1f512fa783302982776895c73714ebbc2",
      "tree": "776b50ee9592803853b3b4c1845f8ba527b868b9",
      "parents": [
        "d0aa7a70bf03b9de9e995ab272293be1f7937822"
      ],
      "author": {
        "name": "Eric Dumazet",
        "email": "dada1@cosmosbay.com",
        "time": "Wed May 09 02:35:04 2007 -0700"
      },
      "committer": {
        "name": "Linus Torvalds",
        "email": "torvalds@woody.linux-foundation.org",
        "time": "Wed May 09 12:30:55 2007 -0700"
      },
      "message": "FUTEX: new PRIVATE futexes\n\n  Analysis of current linux futex code :\n  --------------------------------------\n\nA central hash table futex_queues[] holds all contexts (futex_q) of waiting\nthreads.\n\nEach futex_wait()/futex_wait() has to obtain a spinlock on a hash slot to\nperform lookups or insert/deletion of a futex_q.\n\nWhen a futex_wait() is done, calling thread has to :\n\n1) - Obtain a read lock on mmap_sem to be able to validate the user pointer\n     (calling find_vma()). This validation tells us if the futex uses\n     an inode based store (mapped file), or mm based store (anonymous mem)\n\n2) - compute a hash key\n\n3) - Atomic increment of reference counter on an inode or a mm_struct\n\n4) - lock part of futex_queues[] hash table\n\n5) - perform the test on value of futex.\n\t(rollback is value !\u003d expected_value, returns EWOULDBLOCK)\n\t(various loops if test triggers mm faults)\n\n6) queue the context into hash table, release the lock got in 4)\n\n7) - release the read_lock on mmap_sem\n\n   \u003cblock\u003e\n\n8) Eventually unqueue the context (but rarely, as this part  may be done\n   by the futex_wake())\n\nFutexes were designed to improve scalability but current implementation has\nvarious problems :\n\n- Central hashtable :\n\n  This means scalability problems if many processes/threads want to use\n  futexes at the same time.\n  This means NUMA unbalance because this hashtable is located on one node.\n\n- Using mmap_sem on every futex() syscall :\n\n  Even if mmap_sem is a rw_semaphore, up_read()/down_read() are doing atomic\n  ops on mmap_sem, dirtying cache line :\n    - lot of cache line ping pongs on SMP configurations.\n\n  mmap_sem is also extensively used by mm code (page faults, mmap()/munmap())\n  Highly threaded processes might suffer from mmap_sem contention.\n\n  mmap_sem is also used by oprofile code. Enabling oprofile hurts threaded\n  programs because of contention on the mmap_sem cache line.\n\n- Using an atomic_inc()/atomic_dec() on inode ref counter or mm ref counter:\n  It\u0027s also a cache line ping pong on SMP. It also increases mmap_sem hold time\n  because of cache misses.\n\nMost of these scalability problems come from the fact that futexes are in\none global namespace.  As we use a central hash table, we must make sure\nthey are all using the same reference (given by the mm subsystem).  We\nchose to force all futexes be \u0027shared\u0027.  This has a cost.\n\nBut fact is POSIX defined PRIVATE and SHARED, allowing clear separation,\nand optimal performance if carefuly implemented.  Time has come for linux\nto have better threading performance.\n\nThe goal is to permit new futex commands to avoid :\n - Taking the mmap_sem semaphore, conflicting with other subsystems.\n - Modifying a ref_count on mm or an inode, still conflicting with mm or fs.\n\nThis is possible because, for one process using PTHREAD_PROCESS_PRIVATE\nfutexes, we only need to distinguish futexes by their virtual address, no\nmatter the underlying mm storage is.\n\nIf glibc wants to exploit this new infrastructure, it should use new\n_PRIVATE futex subcommands for PTHREAD_PROCESS_PRIVATE futexes.  And be\nprepared to fallback on old subcommands for old kernels.  Using one global\nvariable with the FUTEX_PRIVATE_FLAG or 0 value should be OK.\n\nPTHREAD_PROCESS_SHARED futexes should still use the old subcommands.\n\nCompatibility with old applications is preserved, they still hit the\nscalability problems, but new applications can fly :)\n\nNote : the same SHARED futex (mapped on a file) can be used by old binaries\n*and* new binaries, because both binaries will use the old subcommands.\n\nNote : Vast majority of futexes should be using PROCESS_PRIVATE semantic,\nas this is the default semantic. Almost all applications should benefit\nof this changes (new kernel and updated libc)\n\nSome bench results on a Pentium M 1.6 GHz (SMP kernel on a UP machine)\n\n/* calling futex_wait(addr, value) with value !\u003d *addr */\n433 cycles per futex(FUTEX_WAIT) call (mixing 2 futexes)\n424 cycles per futex(FUTEX_WAIT) call (using one futex)\n334 cycles per futex(FUTEX_WAIT_PRIVATE) call (mixing 2 futexes)\n334 cycles per futex(FUTEX_WAIT_PRIVATE) call (using one futex)\nFor reference :\n187 cycles per getppid() call\n188 cycles per umask() call\n181 cycles per ni_syscall() call\n\nSigned-off-by: Eric Dumazet \u003cdada1@cosmosbay.com\u003e\nPierre Peiffer \u003cpierre.peiffer@bull.net\u003e\nCc: \"Ulrich Drepper\" \u003cdrepper@gmail.com\u003e\nCc: \"Nick Piggin\" \u003cnickpiggin@yahoo.com.au\u003e\nCc: \"Ingo Molnar\" \u003cmingo@elte.hu\u003e\nCc: Rusty Russell \u003crusty@rustcorp.com.au\u003e\nSigned-off-by: Andrew Morton \u003cakpm@linux-foundation.org\u003e\nSigned-off-by: Linus Torvalds \u003ctorvalds@linux-foundation.org\u003e\n"
    },
    {
      "commit": "d0aa7a70bf03b9de9e995ab272293be1f7937822",
      "tree": "194b30b7b8374b946f166996cb99fb95eb3b7819",
      "parents": [
        "c19384b5b296905d4988c7c684ff540a0f9d65be"
      ],
      "author": {
        "name": "Pierre Peiffer",
        "email": "pierre.peiffer@bull.net",
        "time": "Wed May 09 02:35:02 2007 -0700"
      },
      "committer": {
        "name": "Linus Torvalds",
        "email": "torvalds@woody.linux-foundation.org",
        "time": "Wed May 09 12:30:55 2007 -0700"
      },
      "message": "futex_requeue_pi optimization\n\nThis patch provides the futex_requeue_pi functionality, which allows some\nthreads waiting on a normal futex to be requeued on the wait-queue of a\nPI-futex.\n\nThis provides an optimization, already used for (normal) futexes, to be used\nwith the PI-futexes.\n\nThis optimization is currently used by the glibc in pthread_broadcast, when\nusing \"normal\" mutexes.  With futex_requeue_pi, it can be used with\nPRIO_INHERIT mutexes too.\n\nSigned-off-by: Pierre Peiffer \u003cpierre.peiffer@bull.net\u003e\nCc: Ingo Molnar \u003cmingo@elte.hu\u003e\nCc: Ulrich Drepper \u003cdrepper@redhat.com\u003e\nSigned-off-by: Andrew Morton \u003cakpm@linux-foundation.org\u003e\nSigned-off-by: Linus Torvalds \u003ctorvalds@linux-foundation.org\u003e\n"
    },
    {
      "commit": "c19384b5b296905d4988c7c684ff540a0f9d65be",
      "tree": "071cfe0855d409d63de80ec1b9b663738efb09de",
      "parents": [
        "ec92d08292d3e9b0823eba138a4564d2d39f25c7"
      ],
      "author": {
        "name": "Pierre Peiffer",
        "email": "pierre.peiffer@bull.net",
        "time": "Wed May 09 02:35:02 2007 -0700"
      },
      "committer": {
        "name": "Linus Torvalds",
        "email": "torvalds@woody.linux-foundation.org",
        "time": "Wed May 09 12:30:55 2007 -0700"
      },
      "message": "Make futex_wait() use an hrtimer for timeout\n\nThis patch modifies futex_wait() to use an hrtimer + schedule() in place of\nschedule_timeout().\n\nschedule_timeout() is tick based, therefore the timeout granularity is the\ntick (1 ms, 4 ms or 10 ms depending on HZ).  By using a high resolution timer\nfor timeout wakeup, we can attain a much finer timeout granularity (in the\nmicrosecond range).  This parallels what is already done for futex_lock_pi().\n\nThe timeout passed to the syscall is no longer converted to jiffies and is\ntherefore passed to do_futex() and futex_wait() as an absolute ktime_t\ntherefore keeping nanosecond resolution.\n\nAlso this removes the need to pass the nanoseconds timeout part to\nfutex_lock_pi() in val2.\n\nIn futex_wait(), if there is no timeout then a regular schedule() is\nperformed.  Otherwise, an hrtimer is fired before schedule() is called.\n\n[akpm@linux-foundation.org: fix `make headers_check\u0027]\nSigned-off-by: Sebastien Dugue \u003csebastien.dugue@bull.net\u003e\nSigned-off-by: Pierre Peiffer \u003cpierre.peiffer@bull.net\u003e\nCc: Ingo Molnar \u003cmingo@elte.hu\u003e\nCc: Ulrich Drepper \u003cdrepper@redhat.com\u003e\nSigned-off-by: Andrew Morton \u003cakpm@linux-foundation.org\u003e\nSigned-off-by: Linus Torvalds \u003ctorvalds@linux-foundation.org\u003e\n"
    },
    {
      "commit": "9adef58b1d4fbb58d7daed931b6790c5a3b7543a",
      "tree": "23e5ea2b0a140d244f2ed203b4954309d052e43d",
      "parents": [
        "aa5bd7e929325dbb48be43c3dccf7d1da433e38e"
      ],
      "author": {
        "name": "Rusty Russell",
        "email": "rusty@rustcorp.com.au",
        "time": "Tue May 08 00:26:42 2007 -0700"
      },
      "committer": {
        "name": "Linus Torvalds",
        "email": "torvalds@woody.linux-foundation.org",
        "time": "Tue May 08 11:15:03 2007 -0700"
      },
      "message": "futex: get_futex_key, get_key_refs and drop_key_refs\n\nlguest uses the convenient futex infrastructure for inter-domain I/O, so\nexpose get_futex_key, get_key_refs (renamed get_futex_key_refs) and\ndrop_key_refs (renamed drop_futex_key_refs).  Also means we need to expose the\nunion that these use.\n\nNo code changes.\n\nSigned-off-by: Rusty Russell \u003crusty@rustcorp.com.au\u003e\nCc: Andi Kleen \u003cak@suse.de\u003e\nSigned-off-by: Andrew Morton \u003cakpm@linux-foundation.org\u003e\nSigned-off-by: Linus Torvalds \u003ctorvalds@linux-foundation.org\u003e\n"
    },
    {
      "commit": "58f64d83c37f5073a01573d27043c9c0ccc764f1",
      "tree": "f49a00a30ef547f6c3809ad2cd8aa85c247c9722",
      "parents": [
        "1f29bcd739972f71f2fd5d5d265daf3e1208fa5e"
      ],
      "author": {
        "name": "David Woodhouse",
        "email": "dwmw2@infradead.org",
        "time": "Sun Dec 10 02:19:11 2006 -0800"
      },
      "committer": {
        "name": "Linus Torvalds",
        "email": "torvalds@woody.osdl.org",
        "time": "Sun Dec 10 09:55:41 2006 -0800"
      },
      "message": "[PATCH] Fix noise in futex.h\n\nThere are some kernel-only bits in the middle of \u003clinux/futex.h\u003e which\nshould be removed in what we export to userspace.\n\nSigned-off-by: David Woodhouse \u003cdwmw2@infradead.org\u003e\nSigned-off-by: Andrew Morton \u003cakpm@osdl.org\u003e\nSigned-off-by: Linus Torvalds \u003ctorvalds@osdl.org\u003e\n"
    },
    {
      "commit": "e3f2ddeac718c768fdac4b7fe69d465172f788a8",
      "tree": "5428532dc6c87710c35a71858425f6d726f0e44c",
      "parents": [
        "627371d73cdd04ed23fe098755b4f855138ad9e0"
      ],
      "author": {
        "name": "Ingo Molnar",
        "email": "mingo@elte.hu",
        "time": "Sat Jul 29 05:17:57 2006 +0200"
      },
      "committer": {
        "name": "Linus Torvalds",
        "email": "torvalds@g5.osdl.org",
        "time": "Fri Jul 28 21:02:00 2006 -0700"
      },
      "message": "[PATCH] pi-futex: robust-futex exit\n\nFix robust PI-futexes to be properly unlocked on unexpected exit.\n\nFor this to work the kernel has to know whether a futex is a PI or a\nnon-PI one, because the semantics are different.  Since the space in\nrelevant glibc data structures is extremely scarce, the best solution is\nto encode the \u0027PI\u0027 information in bit 0 of the robust list pointer.\nExisting (non-PI) glibc robust futexes have this bit always zero, so the\nABI is kept.  New glibc with PI-robust-futexes will set this bit.\n\nFurther fixes from Thomas Gleixner \u003ctglx@linutronix.de\u003e\n\nSigned-off-by: Ingo Molnar \u003cmingo@elte.hu\u003e\nSigned-off-by: Ulrich Drepper \u003cdrepper@redhat.com\u003e\nSigned-off-by: Thomas Gleixner \u003ctglx@linutronix.de\u003e\nSigned-off-by: Linus Torvalds \u003ctorvalds@osdl.org\u003e\n"
    },
    {
      "commit": "c87e2837be82df479a6bae9f155c43516d2feebc",
      "tree": "ad6ab35f0b78f71abaa7b05185e9e3f97809c6de",
      "parents": [
        "0cdbee9920fb37eb2dc49b860c2b28862d647adc"
      ],
      "author": {
        "name": "Ingo Molnar",
        "email": "mingo@elte.hu",
        "time": "Tue Jun 27 02:54:58 2006 -0700"
      },
      "committer": {
        "name": "Linus Torvalds",
        "email": "torvalds@g5.osdl.org",
        "time": "Tue Jun 27 17:32:47 2006 -0700"
      },
      "message": "[PATCH] pi-futex: futex_lock_pi/futex_unlock_pi support\n\nThis adds the actual pi-futex implementation, based on rt-mutexes.\n\n[dino@in.ibm.com: fix an oops-causing race]\nSigned-off-by: Ingo Molnar \u003cmingo@elte.hu\u003e\nSigned-off-by: Thomas Gleixner \u003ctglx@linutronix.de\u003e\nSigned-off-by: Arjan van de Ven \u003carjan@linux.intel.com\u003e\nSigned-off-by: Dinakar Guniguntala \u003cdino@in.ibm.com\u003e\nSigned-off-by: Andrew Morton \u003cakpm@osdl.org\u003e\nSigned-off-by: Linus Torvalds \u003ctorvalds@osdl.org\u003e\n"
    },
    {
      "commit": "e2970f2fb6950183a34e8545faa093eb49d186e1",
      "tree": "a4035274368d846488a3b0152925502c06b064b0",
      "parents": [
        "66e5393a78b3fcca63e7748e38221dcca61c4aab"
      ],
      "author": {
        "name": "Ingo Molnar",
        "email": "mingo@elte.hu",
        "time": "Tue Jun 27 02:54:47 2006 -0700"
      },
      "committer": {
        "name": "Linus Torvalds",
        "email": "torvalds@g5.osdl.org",
        "time": "Tue Jun 27 17:32:46 2006 -0700"
      },
      "message": "[PATCH] pi-futex: futex code cleanups\n\nWe are pleased to announce \"lightweight userspace priority inheritance\" (PI)\nsupport for futexes.  The following patchset and glibc patch implements it,\nontop of the robust-futexes patchset which is included in 2.6.16-mm1.\n\nWe are calling it lightweight for 3 reasons:\n\n - in the user-space fastpath a PI-enabled futex involves no kernel work\n   (or any other PI complexity) at all.  No registration, no extra kernel\n   calls - just pure fast atomic ops in userspace.\n\n - in the slowpath (in the lock-contention case), the system call and\n   scheduling pattern is in fact better than that of normal futexes, due to\n   the \u0027integrated\u0027 nature of FUTEX_LOCK_PI.  [more about that further down]\n\n - the in-kernel PI implementation is streamlined around the mutex\n   abstraction, with strict rules that keep the implementation relatively\n   simple: only a single owner may own a lock (i.e.  no read-write lock\n   support), only the owner may unlock a lock, no recursive locking, etc.\n\n  Priority Inheritance - why, oh why???\n  -------------------------------------\n\nMany of you heard the horror stories about the evil PI code circling Linux for\nyears, which makes no real sense at all and is only used by buggy applications\nand which has horrible overhead.  Some of you have dreaded this very moment,\nwhen someone actually submits working PI code ;-)\n\nSo why would we like to see PI support for futexes?\n\nWe\u0027d like to see it done purely for technological reasons.  We dont think it\u0027s\na buggy concept, we think it\u0027s useful functionality to offer to applications,\nwhich functionality cannot be achieved in other ways.  We also think it\u0027s the\nright thing to do, and we think we\u0027ve got the right arguments and the right\nnumbers to prove that.  We also believe that we can address all the\ncounter-arguments as well.  For these reasons (and the reasons outlined below)\nwe are submitting this patch-set for upstream kernel inclusion.\n\nWhat are the benefits of PI?\n\n  The short reply:\n  ----------------\n\nUser-space PI helps achieving/improving determinism for user-space\napplications.  In the best-case, it can help achieve determinism and\nwell-bound latencies.  Even in the worst-case, PI will improve the statistical\ndistribution of locking related application delays.\n\n  The longer reply:\n  -----------------\n\nFirstly, sharing locks between multiple tasks is a common programming\ntechnique that often cannot be replaced with lockless algorithms.  As we can\nsee it in the kernel [which is a quite complex program in itself], lockless\nstructures are rather the exception than the norm - the current ratio of\nlockless vs.  locky code for shared data structures is somewhere between 1:10\nand 1:100.  Lockless is hard, and the complexity of lockless algorithms often\nendangers to ability to do robust reviews of said code.  I.e.  critical RT\napps often choose lock structures to protect critical data structures, instead\nof lockless algorithms.  Furthermore, there are cases (like shared hardware,\nor other resource limits) where lockless access is mathematically impossible.\n\nMedia players (such as Jack) are an example of reasonable application design\nwith multiple tasks (with multiple priority levels) sharing short-held locks:\nfor example, a highprio audio playback thread is combined with medium-prio\nconstruct-audio-data threads and low-prio display-colory-stuff threads.  Add\nvideo and decoding to the mix and we\u0027ve got even more priority levels.\n\nSo once we accept that synchronization objects (locks) are an unavoidable fact\nof life, and once we accept that multi-task userspace apps have a very fair\nexpectation of being able to use locks, we\u0027ve got to think about how to offer\nthe option of a deterministic locking implementation to user-space.\n\nMost of the technical counter-arguments against doing priority inheritance\nonly apply to kernel-space locks.  But user-space locks are different, there\nwe cannot disable interrupts or make the task non-preemptible in a critical\nsection, so the \u0027use spinlocks\u0027 argument does not apply (user-space spinlocks\nhave the same priority inversion problems as other user-space locking\nconstructs).  Fact is, pretty much the only technique that currently enables\ngood determinism for userspace locks (such as futex-based pthread mutexes) is\npriority inheritance:\n\nCurrently (without PI), if a high-prio and a low-prio task shares a lock [this\nis a quite common scenario for most non-trivial RT applications], even if all\ncritical sections are coded carefully to be deterministic (i.e.  all critical\nsections are short in duration and only execute a limited number of\ninstructions), the kernel cannot guarantee any deterministic execution of the\nhigh-prio task: any medium-priority task could preempt the low-prio task while\nit holds the shared lock and executes the critical section, and could delay it\nindefinitely.\n\n  Implementation:\n  ---------------\n\nAs mentioned before, the userspace fastpath of PI-enabled pthread mutexes\ninvolves no kernel work at all - they behave quite similarly to normal\nfutex-based locks: a 0 value means unlocked, and a value\u003d\u003dTID means locked.\n(This is the same method as used by list-based robust futexes.) Userspace uses\natomic ops to lock/unlock these mutexes without entering the kernel.\n\nTo handle the slowpath, we have added two new futex ops:\n\n  FUTEX_LOCK_PI\n  FUTEX_UNLOCK_PI\n\nIf the lock-acquire fastpath fails, [i.e.  an atomic transition from 0 to TID\nfails], then FUTEX_LOCK_PI is called.  The kernel does all the remaining work:\nif there is no futex-queue attached to the futex address yet then the code\nlooks up the task that owns the futex [it has put its own TID into the futex\nvalue], and attaches a \u0027PI state\u0027 structure to the futex-queue.  The pi_state\nincludes an rt-mutex, which is a PI-aware, kernel-based synchronization\nobject.  The \u0027other\u0027 task is made the owner of the rt-mutex, and the\nFUTEX_WAITERS bit is atomically set in the futex value.  Then this task tries\nto lock the rt-mutex, on which it blocks.  Once it returns, it has the mutex\nacquired, and it sets the futex value to its own TID and returns.  Userspace\nhas no other work to perform - it now owns the lock, and futex value contains\nFUTEX_WAITERS|TID.\n\nIf the unlock side fastpath succeeds, [i.e.  userspace manages to do a TID -\u003e\n0 atomic transition of the futex value], then no kernel work is triggered.\n\nIf the unlock fastpath fails (because the FUTEX_WAITERS bit is set), then\nFUTEX_UNLOCK_PI is called, and the kernel unlocks the futex on the behalf of\nuserspace - and it also unlocks the attached pi_state-\u003ert_mutex and thus wakes\nup any potential waiters.\n\nNote that under this approach, contrary to other PI-futex approaches, there is\nno prior \u0027registration\u0027 of a PI-futex.  [which is not quite possible anyway,\ndue to existing ABI properties of pthread mutexes.]\n\nAlso, under this scheme, \u0027robustness\u0027 and \u0027PI\u0027 are two orthogonal properties\nof futexes, and all four combinations are possible: futex, robust-futex,\nPI-futex, robust+PI-futex.\n\n  glibc support:\n  --------------\n\nUlrich Drepper and Jakub Jelinek have written glibc support for PI-futexes\n(and robust futexes), enabling robust and PI (PTHREAD_PRIO_INHERIT) POSIX\nmutexes.  (PTHREAD_PRIO_PROTECT support will be added later on too, no\nadditional kernel changes are needed for that).  [NOTE: The glibc patch is\nobviously inofficial and unsupported without matching upstream kernel\nfunctionality.]\n\nthe patch-queue and the glibc patch can also be downloaded from:\n\n  http://redhat.com/~mingo/PI-futex-patches/\n\nMany thanks go to the people who helped us create this kernel feature: Steven\nRostedt, Esben Nielsen, Benedikt Spranger, Daniel Walker, John Cooper, Arjan\nvan de Ven, Oleg Nesterov and others.  Credits for related prior projects goes\nto Dirk Grambow, Inaky Perez-Gonzalez, Bill Huey and many others.\n\nClean up the futex code, before adding more features to it:\n\n - use u32 as the futex field type - that\u0027s the ABI\n - use __user and pointers to u32 instead of unsigned long\n - code style / comment style cleanups\n - rename hash-bucket name from \u0027bh\u0027 to \u0027hb\u0027.\n\nI checked the pre and post futex.o object files to make sure this\npatch has no code effects.\n\nSigned-off-by: Ingo Molnar \u003cmingo@elte.hu\u003e\nSigned-off-by: Thomas Gleixner \u003ctglx@linutronix.de\u003e\nSigned-off-by: Arjan van de Ven \u003carjan@linux.intel.com\u003e\nCc: Ulrich Drepper \u003cdrepper@redhat.com\u003e\nCc: Jakub Jelinek \u003cjakub@redhat.com\u003e\nSigned-off-by: Andrew Morton \u003cakpm@osdl.org\u003e\nSigned-off-by: Linus Torvalds \u003ctorvalds@osdl.org\u003e\n"
    },
    {
      "commit": "76b81e2b0e2241accebcc68e126bc5ab958661b9",
      "tree": "0d99cdc838cc2e7a5c383a56ec707ac739739d2c",
      "parents": [
        "8f17d3a5049d32392b79925c73a0cf99ce6d5af0"
      ],
      "author": {
        "name": "Ingo Molnar",
        "email": "mingo@elte.hu",
        "time": "Mon Mar 27 01:16:28 2006 -0800"
      },
      "committer": {
        "name": "Linus Torvalds",
        "email": "torvalds@g5.osdl.org",
        "time": "Mon Mar 27 08:44:50 2006 -0800"
      },
      "message": "[PATCH] lightweight robust futexes updates 2\n\nfutex.h updates:\n\n- get rid of FUTEX_OWNER_PENDING - it\u0027s not used\n- reduce ROBUST_LIST_LIMIT to a saner value\n\nSigned-off-by: Ingo Molnar \u003cmingo@elte.hu\u003e\nSigned-off-by: Andrew Morton \u003cakpm@osdl.org\u003e\nSigned-off-by: Linus Torvalds \u003ctorvalds@osdl.org\u003e\n"
    },
    {
      "commit": "8f17d3a5049d32392b79925c73a0cf99ce6d5af0",
      "tree": "3c2aa0cbe337684d353dd2cfb0c177b4ae15217c",
      "parents": [
        "8fdd6c6df7889dc89df3d9fe0f5bbe6733e39f48"
      ],
      "author": {
        "name": "Ingo Molnar",
        "email": "mingo@elte.hu",
        "time": "Mon Mar 27 01:16:27 2006 -0800"
      },
      "committer": {
        "name": "Linus Torvalds",
        "email": "torvalds@g5.osdl.org",
        "time": "Mon Mar 27 08:44:49 2006 -0800"
      },
      "message": "[PATCH] lightweight robust futexes updates\n\n- fix: initialize the robust list(s) to NULL in copy_process.\n\n- doc update\n\n- cleanup: rename _inuser to _inatomic\n\n- __user cleanups and other small cleanups\n\nSigned-off-by: Ingo Molnar \u003cmingo@elte.hu\u003e\nCc: Thomas Gleixner \u003ctglx@linutronix.de\u003e\nCc: Arjan van de Ven \u003carjan@infradead.org\u003e\nCc: Ulrich Drepper \u003cdrepper@redhat.com\u003e\nCc: Andi Kleen \u003cak@muc.de\u003e\nSigned-off-by: Andrew Morton \u003cakpm@osdl.org\u003e\nSigned-off-by: Linus Torvalds \u003ctorvalds@osdl.org\u003e\n"
    },
    {
      "commit": "0771dfefc9e538f077d0b43b6dec19a5a67d0e70",
      "tree": "696267e69228b7406b337f9651dedc75055a589e",
      "parents": [
        "e9056f13bfcdd054a0c3d730e4e096748d8a363a"
      ],
      "author": {
        "name": "Ingo Molnar",
        "email": "mingo@elte.hu",
        "time": "Mon Mar 27 01:16:22 2006 -0800"
      },
      "committer": {
        "name": "Linus Torvalds",
        "email": "torvalds@g5.osdl.org",
        "time": "Mon Mar 27 08:44:49 2006 -0800"
      },
      "message": "[PATCH] lightweight robust futexes: core\n\nAdd the core infrastructure for robust futexes: structure definitions, the new\nsyscalls and the do_exit() based cleanup mechanism.\n\nSigned-off-by: Ingo Molnar \u003cmingo@elte.hu\u003e\nSigned-off-by: Thomas Gleixner \u003ctglx@linutronix.de\u003e\nSigned-off-by: Arjan van de Ven \u003carjan@infradead.org\u003e\nAcked-by: Ulrich Drepper \u003cdrepper@redhat.com\u003e\nCc: Michael Kerrisk \u003cmtk-manpages@gmx.net\u003e\nSigned-off-by: Andrew Morton \u003cakpm@osdl.org\u003e\nSigned-off-by: Linus Torvalds \u003ctorvalds@osdl.org\u003e\n"
    },
    {
      "commit": "4732efbeb997189d9f9b04708dc26bf8613ed721",
      "tree": "885308bb2b521e52e13aaa8a67c78b2ab3c18cd8",
      "parents": [
        "5b039e681b8c5f30aac9cc04385cc94be45d0823"
      ],
      "author": {
        "name": "Jakub Jelinek",
        "email": "jakub@redhat.com",
        "time": "Tue Sep 06 15:16:25 2005 -0700"
      },
      "committer": {
        "name": "Linus Torvalds",
        "email": "torvalds@g5.osdl.org",
        "time": "Wed Sep 07 16:57:17 2005 -0700"
      },
      "message": "[PATCH] FUTEX_WAKE_OP: pthread_cond_signal() speedup\n\nATM pthread_cond_signal is unnecessarily slow, because it wakes one waiter\n(which at least on UP usually means an immediate context switch to one of\nthe waiter threads).  This waiter wakes up and after a few instructions it\nattempts to acquire the cv internal lock, but that lock is still held by\nthe thread calling pthread_cond_signal.  So it goes to sleep and eventually\nthe signalling thread is scheduled in, unlocks the internal lock and wakes\nthe waiter again.\n\nNow, before 2003-09-21 NPTL was using FUTEX_REQUEUE in pthread_cond_signal\nto avoid this performance issue, but it was removed when locks were\nredesigned to the 3 state scheme (unlocked, locked uncontended, locked\ncontended).\n\nFollowing scenario shows why simply using FUTEX_REQUEUE in\npthread_cond_signal together with using lll_mutex_unlock_force in place of\nlll_mutex_unlock is not enough and probably why it has been disabled at\nthat time:\n\nThe number is value in cv-\u003e__data.__lock.\n        thr1            thr2            thr3\n0       pthread_cond_wait\n1       lll_mutex_lock (cv-\u003e__data.__lock)\n0       lll_mutex_unlock (cv-\u003e__data.__lock)\n0       lll_futex_wait (\u0026cv-\u003e__data.__futex, futexval)\n0                       pthread_cond_signal\n1                       lll_mutex_lock (cv-\u003e__data.__lock)\n1                                       pthread_cond_signal\n2                                       lll_mutex_lock (cv-\u003e__data.__lock)\n2                                         lll_futex_wait (\u0026cv-\u003e__data.__lock, 2)\n2                       lll_futex_requeue (\u0026cv-\u003e__data.__futex, 0, 1, \u0026cv-\u003e__data.__lock)\n                          # FUTEX_REQUEUE, not FUTEX_CMP_REQUEUE\n2                       lll_mutex_unlock_force (cv-\u003e__data.__lock)\n0                         cv-\u003e__data.__lock \u003d 0\n0                         lll_futex_wake (\u0026cv-\u003e__data.__lock, 1)\n1       lll_mutex_lock (cv-\u003e__data.__lock)\n0       lll_mutex_unlock (cv-\u003e__data.__lock)\n          # Here, lll_mutex_unlock doesn\u0027t know there are threads waiting\n          # on the internal cv\u0027s lock\n\nNow, I believe it is possible to use FUTEX_REQUEUE in pthread_cond_signal,\nbut it will cost us not one, but 2 extra syscalls and, what\u0027s worse, one of\nthese extra syscalls will be done for every single waiting loop in\npthread_cond_*wait.\n\nWe would need to use lll_mutex_unlock_force in pthread_cond_signal after\nrequeue and lll_mutex_cond_lock in pthread_cond_*wait after lll_futex_wait.\n\nAnother alternative is to do the unlocking pthread_cond_signal needs to do\n(the lock can\u0027t be unlocked before lll_futex_wake, as that is racy) in the\nkernel.\n\nI have implemented both variants, futex-requeue-glibc.patch is the first\none and futex-wake_op{,-glibc}.patch is the unlocking inside of the kernel.\n The kernel interface allows userland to specify how exactly an unlocking\noperation should look like (some atomic arithmetic operation with optional\nconstant argument and comparison of the previous futex value with another\nconstant).\n\nIt has been implemented just for ppc*, x86_64 and i?86, for other\narchitectures I\u0027m including just a stub header which can be used as a\nstarting point by maintainers to write support for their arches and ATM\nwill just return -ENOSYS for FUTEX_WAKE_OP.  The requeue patch has been\n(lightly) tested just on x86_64, the wake_op patch on ppc64 kernel running\n32-bit and 64-bit NPTL and x86_64 kernel running 32-bit and 64-bit NPTL.\n\nWith the following benchmark on UP x86-64 I get:\n\nfor i in nptl-orig nptl-requeue nptl-wake_op; do echo time elf/ld.so --library-path .:$i /tmp/bench; \\\nfor j in 1 2; do echo ( time elf/ld.so --library-path .:$i /tmp/bench ) 2\u003e\u00261; done; done\ntime elf/ld.so --library-path .:nptl-orig /tmp/bench\nreal 0m0.655s user 0m0.253s sys 0m0.403s\nreal 0m0.657s user 0m0.269s sys 0m0.388s\ntime elf/ld.so --library-path .:nptl-requeue /tmp/bench\nreal 0m0.496s user 0m0.225s sys 0m0.271s\nreal 0m0.531s user 0m0.242s sys 0m0.288s\ntime elf/ld.so --library-path .:nptl-wake_op /tmp/bench\nreal 0m0.380s user 0m0.176s sys 0m0.204s\nreal 0m0.382s user 0m0.175s sys 0m0.207s\n\nThe benchmark is at:\nhttp://sourceware.org/ml/libc-alpha/2005-03/txt00001.txt\nOlder futex-requeue-glibc.patch version is at:\nhttp://sourceware.org/ml/libc-alpha/2005-03/txt00002.txt\nOlder futex-wake_op-glibc.patch version is at:\nhttp://sourceware.org/ml/libc-alpha/2005-03/txt00003.txt\nWill post a new version (just x86-64 fixes so that the patch\napplies against pthread_cond_signal.S) to libc-hacker ml soon.\n\nAttached is the kernel FUTEX_WAKE_OP patch as well as a simple-minded\ntestcase that will not test the atomicity of the operation, but at least\ncheck if the threads that should have been woken up are woken up and\nwhether the arithmetic operation in the kernel gave the expected results.\n\nAcked-by: Ingo Molnar \u003cmingo@redhat.com\u003e\nCc: Ulrich Drepper \u003cdrepper@redhat.com\u003e\nCc: Jamie Lokier \u003cjamie@shareable.org\u003e\nCc: Rusty Russell \u003crusty@rustcorp.com.au\u003e\nSigned-off-by: Yoichi Yuasa \u003cyuasa@hh.iij4u.or.jp\u003e\nSigned-off-by: Andrew Morton \u003cakpm@osdl.org\u003e\nSigned-off-by: Linus Torvalds \u003ctorvalds@osdl.org\u003e\n"
    },
    {
      "commit": "1da177e4c3f41524e886b7f1b8a0c1fc7321cac2",
      "tree": "0bba044c4ce775e45a88a51686b5d9f90697ea9d",
      "parents": [],
      "author": {
        "name": "Linus Torvalds",
        "email": "torvalds@ppc970.osdl.org",
        "time": "Sat Apr 16 15:20:36 2005 -0700"
      },
      "committer": {
        "name": "Linus Torvalds",
        "email": "torvalds@ppc970.osdl.org",
        "time": "Sat Apr 16 15:20:36 2005 -0700"
      },
      "message": "Linux-2.6.12-rc2\n\nInitial git repository build. I\u0027m not bothering with the full history,\neven though we have it. We can create a separate \"historical\" git\narchive of that later if we want to, and in the meantime it\u0027s about\n3.2GB when imported into git - space that would just make the early\ngit days unnecessarily complicated, when we don\u0027t have a lot of good\ninfrastructure for it.\n\nLet it rip!\n"
    }
  ]
}
