)]}'
{
  "commit": "fff3fd8a1210a165252cd7cd01206da7a90d3a06",
  "tree": "3db89d48720ba726999e9d8486d8e991c7664123",
  "parents": [
    "3908836aa77e3621aaf2101f2920e01d7c8460d6"
  ],
  "author": {
    "name": "Michel Lespinasse",
    "email": "walken@google.com",
    "time": "Mon Oct 08 16:31:23 2012 -0700"
  },
  "committer": {
    "name": "Linus Torvalds",
    "email": "torvalds@linux-foundation.org",
    "time": "Tue Oct 09 16:22:39 2012 +0900"
  },
  "message": "rbtree: add prio tree and interval tree tests\n\nPatch 1 implements support for interval trees, on top of the augmented\nrbtree API. It also adds synthetic tests to compare the performance of\ninterval trees vs prio trees. Short answers is that interval trees are\nslightly faster (~25%) on insert/erase, and much faster (~2.4 - 3x)\non search. It is debatable how realistic the synthetic test is, and I have\nnot made such measurements yet, but my impression is that interval trees\nwould still come out faster.\n\nPatch 2 uses a preprocessor template to make the interval tree generic,\nand uses it as a replacement for the vma prio_tree.\n\nPatch 3 takes the other prio_tree user, kmemleak, and converts it to use\na basic rbtree. We don\u0027t actually need the augmented rbtree support here\nbecause the intervals are always non-overlapping.\n\nPatch 4 removes the now-unused prio tree library.\n\nPatch 5 proposes an additional optimization to rb_erase_augmented, now\nproviding it as an inline function so that the augmented callbacks can be\ninlined in. This provides an additional 5-10% performance improvement\nfor the interval tree insert/erase benchmark. There is a maintainance cost\nas it exposes augmented rbtree users to some of the rbtree library internals;\nhowever I think this cost shouldn\u0027t be too high as I expect the augmented\nrbtree will always have much less users than the base rbtree.\n\nI should probably add a quick summary of why I think it makes sense to\nreplace prio trees with augmented rbtree based interval trees now.  One of\nthe drivers is that we need augmented rbtrees for Rik\u0027s vma gap finding\ncode, and once you have them, it just makes sense to use them for interval\ntrees as well, as this is the simpler and more well known algorithm.  prio\ntrees, in comparison, seem *too* clever: they impose an additional \u0027heap\u0027\nconstraint on the tree, which they use to guarantee a faster worst-case\ncomplexity of O(k+log N) for stabbing queries in a well-balanced prio\ntree, vs O(k*log N) for interval trees (where k\u003dnumber of matches,\nN\u003dnumber of intervals).  Now this sounds great, but in practice prio trees\ndon\u0027t realize this theorical benefit.  First, the additional constraint\nmakes them harder to update, so that the kernel implementation has to\nsimplify things by balancing them like a radix tree, which is not always\nideal.  Second, the fact that there are both index and heap properties\nmakes both tree manipulation and search more complex, which results in a\nhigher multiplicative time constant.  As it turns out, the simple interval\ntree algorithm ends up running faster than the more clever prio tree.\n\nThis patch:\n\nAdd two test modules:\n\n- prio_tree_test measures the performance of lib/prio_tree.c, both for\n  insertion/removal and for stabbing searches\n\n- interval_tree_test measures the performance of a library of equivalent\n  functionality, built using the augmented rbtree support.\n\nIn order to support the second test module, lib/interval_tree.c is\nintroduced. It is kept separate from the interval_tree_test main file\nfor two reasons: first we don\u0027t want to provide an unfair advantage\nover prio_tree_test by having everything in a single compilation unit,\nand second there is the possibility that the interval tree functionality\ncould get some non-test users in kernel over time.\n\nSigned-off-by: Michel Lespinasse \u003cwalken@google.com\u003e\nCc: Rik van Riel \u003criel@redhat.com\u003e\nCc: Hillf Danton \u003cdhillf@gmail.com\u003e\nCc: Peter Zijlstra \u003ca.p.zijlstra@chello.nl\u003e\nCc: Catalin Marinas \u003ccatalin.marinas@arm.com\u003e\nCc: Andrea Arcangeli \u003caarcange@redhat.com\u003e\nCc: David Woodhouse \u003cdwmw2@infradead.org\u003e\nSigned-off-by: Andrew Morton \u003cakpm@linux-foundation.org\u003e\nSigned-off-by: Linus Torvalds \u003ctorvalds@linux-foundation.org\u003e\n",
  "tree_diff": [
    {
      "type": "add",
      "old_id": "0000000000000000000000000000000000000000",
      "old_mode": 0,
      "old_path": "/dev/null",
      "new_id": "724556aa3c957f66f39f2487149c2242471a9f1f",
      "new_mode": 33188,
      "new_path": "include/linux/interval_tree.h"
    },
    {
      "type": "modify",
      "old_id": "a4e5d93b0f4125235a1170a919d59c4c8855e54c",
      "old_mode": 33188,
      "old_path": "lib/Kconfig.debug",
      "new_id": "ee9f030b69518d093d3866bf0fbdf2676b45c363",
      "new_mode": 33188,
      "new_path": "lib/Kconfig.debug"
    },
    {
      "type": "modify",
      "old_id": "f49445d26b65bfba47199c1df0d84db35435dae2",
      "old_mode": 33188,
      "old_path": "lib/Makefile",
      "new_id": "26f578bf616af72a888f0fb47847dd971df68210",
      "new_mode": 33188,
      "new_path": "lib/Makefile"
    },
    {
      "type": "add",
      "old_id": "0000000000000000000000000000000000000000",
      "old_mode": 0,
      "old_path": "/dev/null",
      "new_id": "6fd540b1e4990153981225813044a7c53deb81d7",
      "new_mode": 33188,
      "new_path": "lib/interval_tree.c"
    },
    {
      "type": "add",
      "old_id": "0000000000000000000000000000000000000000",
      "old_mode": 0,
      "old_path": "/dev/null",
      "new_id": "b25903987f7aeb046dc48b75fd3bafe4d4967533",
      "new_mode": 33188,
      "new_path": "lib/interval_tree_test_main.c"
    },
    {
      "type": "modify",
      "old_id": "8d443af03b4cd52998948b008052712a81d754eb",
      "old_mode": 33188,
      "old_path": "lib/prio_tree.c",
      "new_id": "4e0d2edff2b4eacdd9bdfb34ace209ef5d037595",
      "new_mode": 33188,
      "new_path": "lib/prio_tree.c"
    },
    {
      "type": "add",
      "old_id": "0000000000000000000000000000000000000000",
      "old_mode": 0,
      "old_path": "/dev/null",
      "new_id": "c26084ddc6a45534d69e394e6d02df35e9c59a84",
      "new_mode": 33188,
      "new_path": "lib/prio_tree_test.c"
    }
  ]
}
