{"push_id":840090384,"size":1,"distinct_size":1,"ref":"refs/heads/letstryagain","head":"5e67e313f93df5a5a82a93fe9ed29896dcb876aa","before":"a4c337fdd0ed30cbfce6db5c407e2931e67c60cb","commits":[{"sha":"5e67e313f93df5a5a82a93fe9ed29896dcb876aa","author":{"email":"c48a977c99df211699aa56461f1372547350aebb@gmail.com","name":"LaboDJ"},"message":"SL[aou]B fixes\n\nslub: use __SetPageSlab function to set PG_slab flag\n\nTo set page-flag, using SetPageXXXX() and __SetPageXXXX() is more\nunderstandable and maintainable. So change it.\n\nSigned-off-by: Joonsoo Kim <js1304@gmail.com>\nSigned-off-by: Pekka Enberg <penberg@kernel.org>\nslub: Use freelist instead of \"object\" in __slab_alloc\n\nThe variable \"object\" really refers to a list of objects that we\nare handling.\n\nSigned-off-by: Christoph Lameter <cl@linux.com>\nSigned-off-by: Pekka Enberg <penberg@kernel.org>\nslub: Add frozen check in __slab_alloc\n\nVerify that objects returned from __slab_alloc come from slab pages\nin the correct state.\n\nSigned-off-by: Christoph Lameter <cl@linux.com>\nSigned-off-by: Pekka Enberg <penberg@kernel.org>\nslub: Acquire_slab() avoid loop\n\nAvoid the loop in acquire slab and simply fail if there is a conflict.\n\nThis will cause the next page on the list to be considered.\n\nAcked-by: David Rientjes <rientjes@google.com>\nSigned-off-by: Christoph Lameter <cl@linux.com>\nSigned-off-by: Pekka Enberg <penberg@kernel.org>\nSigned-off-by: Paul Reioux <reioux@gmail.com>\n\nConflicts:\n\tmm/slub.c\nslub: Simplify control flow in __slab_alloc()\n\nSimplify control flow a bit avoiding nesting.\n\nSigned-off-by: Christoph Lameter <cl@linux.com>\nSigned-off-by: Pekka Enberg <penberg@kernel.org>\nslub: new_slab_objects() can also get objects from partial list\n\nMoving the attempt to get a slab page from the partial lists simplifies\n__slab_alloc which is rather complicated.\n\nSigned-off-by: Christoph Lameter <cl@linux.com>\nSigned-off-by: Pekka Enberg <penberg@kernel.org>\nslub: Get rid of the node field\n\nThe node field is always page_to_nid(c->page). So its rather easy to\nreplace. Note that there maybe slightly more overhead in various hot paths\ndue to the need to shift the bits from page->flags. However, that is mostly\ncompensated for by a smaller footprint of the kmem_cache_cpu structure (this\npatch reduces that to 3 words per cache) which allows better caching.\n\nSigned-off-by: Christoph Lameter <cl@linux.com>\nSigned-off-by: Pekka Enberg <penberg@kernel.org>\nslub: Separate out kmem_cache_cpu processing from deactivate_slab\n\nProcessing on fields of kmem_cache_cpu is cleaner if code working on fields\nof this struct is taken out of deactivate_slab().\n\nAcked-by: David Rientjes <rientjes@google.com>\nSigned-off-by: Christoph Lameter <cl@linux.com>\nSigned-off-by: Pekka Enberg <penberg@kernel.org>\nslub: Use page variable instead of c->page.\n\nStore the value of c->page to avoid additional fetches\nfrom per cpu data.\n\nAcked-by: David Rientjes <rientjes@google.com>\nSigned-off-by: Christoph Lameter <cl@linux.com>\nSigned-off-by: Pekka Enberg <penberg@kernel.org>\nslub: pass page to node_match() instead of kmem_cache_cpu structure\n\nAvoid passing the kmem_cache_cpu pointer to node_match. This makes the\nnode_match function more generic and easier to understand.\n\nAcked-by: David Rientjes <rientjes@google.com>\nSigned-off-by: Christoph Lameter <cl@linux.com>\nSigned-off-by: Pekka Enberg <penberg@kernel.org>\n\nSigned-off-by: Paul Reioux <reioux@gmail.com>\nslob: Define page struct fields used in mm_types.h\n\nDefine the fields used by slob in mm_types.h and use struct page instead\nof struct slob_page in slob. This cleans up numerous of typecasts in slob.c and\nmakes readers aware of slob's use of page struct fields.\n\n[Also cleans up some bitrot in slob.c. The page struct field layout\nin slob.c is an old layout and does not match the one in mm_types.h]\n\nReviewed-by: Glauber Costa <glommer@parallels.com>\nAcked-by: David Rientjes <rientjes@google.com>\nReviewed-by: Joonsoo Kim <js1304@gmail.com>\nSigned-off-by: Christoph Lameter <cl@linux.com>\nSigned-off-by: Pekka Enberg <penberg@kernel.org>\nslab: Use page struct fields instead of casting\n\nAdd fields to the page struct so that it is properly documented that\nslab overlays the lru fields.\n\nThis cleans up some casts in slab.\n\nReviewed-by: Glauber Costa <glommer@parallels.com>\nReviewed-by: Joonsoo Kim <js1304@gmail.com>\nSigned-off-by: Christoph Lameter <cl@linux.com>\nSigned-off-by: Pekka Enberg <penberg@kernel.org>\nslab: Remove some accessors\n\nThose are rather trivial now and its better to see inline what is\nreally going on.\n\nSigned-off-by: Christoph Lameter <cl@linux.com>\nSigned-off-by: Pekka Enberg <penberg@kernel.org>\nslob: No need to zero mapping since it is no longer in use\n\nReviewed-by: Joonsoo Kim <js1304@gmail.com>\nAcked-by: David Rientjes <rientjes@google.com>\nSigned-off-by: Christoph Lameter <cl@linux.com>\nSigned-off-by: Pekka Enberg <penberg@kernel.org>\nslob: Remove various small accessors\n\nThose have become so simple that they are no longer needed.\n\nReviewed-by: Joonsoo Kim <js1304@gmail.com>\nAcked-by: David Rientjes <rientjes@google.com>\nsigned-off-by: Christoph Lameter <cl@linux.com>\n\nSigned-off-by: Pekka Enberg <penberg@kernel.org>\nmm, sl[aou]b: Extract common fields from struct kmem_cache\n\nDefine a struct that describes common fields used in all slab allocators.\nA slab allocator either uses the common definition (like SLOB) or is\nrequired to provide members of kmem_cache with the definition given.\n\nAfter that it will be possible to share code that\nonly operates on those fields of kmem_cache.\n\nThe patch basically takes the slob definition of kmem cache and\nuses the field namees for the other allocators.\n\nIt also standardizes the names used for basic object lengths in\nallocators:\n\nobject_size\tStruct size specified at kmem_cache_create. Basically\n\t\tthe payload expected to be used by the subsystem.\n\nsize\t\tThe size of memory allocator for each object. This size\n\t\tis larger than object_size and includes padding, alignment\n\t\tand extra metadata for each object (f.e. for debugging\n\t\tand rcu).\n\nSigned-off-by: Christoph Lameter <cl@linux.com>\nSigned-off-by: Pekka Enberg <penberg@kernel.org>\nmm, sl[aou]b: Extract common code for kmem_cache_create()\n\nKmem_cache_create() does a variety of sanity checks but those\nvary depending on the allocator. Use the strictest tests and put them into\na slab_common file. Make the tests conditional on CONFIG_DEBUG_VM.\n\nThis patch has the effect of adding sanity checks for SLUB and SLOB\nunder CONFIG_DEBUG_VM and removes the checks in SLAB for !CONFIG_DEBUG_VM.\n\nSigned-off-by: Christoph Lameter <cl@linux.com>\nSigned-off-by: Pekka Enberg <penberg@kernel.org>\n\nSigned-off-by: Paul Reioux <reioux@gmail.com>\nslob: Fix early boot kernel crash\n\nCommit fd3142a59af2012a7c5dc72ec97a4935ff1c5fc6 broke\nslob since a piece of a change for a later patch slipped into\nit.\n\nFengguang Wu writes:\n\n  The commit crashes the kernel w/o any dmesg output (the attached one is\n  created by the script as a summary for that run). This is very\n  reproducible in kvm for the attached config.\n\nReported-by: Fengguang Wu <fengguang.wu@intel.com>\nSigned-off-by: Christoph Lameter <cl@linux.com>\nSigned-off-by: Pekka Enberg <penberg@kernel.org>\nslab: Get rid of obj_size macro\n\nThe size of the slab object is frequently needed. Since we now\nhave a size field directly in the kmem_cache structure there is no\nneed anymore of the obj_size macro/function.\n\nSigned-off-by: Christoph Lameter <cl@linux.com>\nSigned-off-by: Pekka Enberg <penberg@kernel.org>\nslab/mempolicy: always use local policy from interrupt context\n\nslab_node() could access current->mempolicy from interrupt context.\nHowever there's a race condition during exit where the mempolicy\nis first freed and then the pointer zeroed.\n\nUsing this from interrupts seems bogus anyways. The interrupt\nwill interrupt a random process and therefore get a random\nmempolicy. Many times, this will be idle's, which noone can change.\n\nJust disable this here and always use local for slab\nfrom interrupts. I also cleaned up the callers of slab_node a bit\nwhich always passed the same argument.\n\nI believe the original mempolicy code did that in fact,\nso it's likely a regression.\n\nv2: send version with correct logic\nv3: simplify. fix typo.\nReported-by: Arun Sharma <asharma@fb.com>\nCc: penberg@kernel.org\nCc: cl@linux.com\nSigned-off-by: Andi Kleen <ak@linux.intel.com>\n[tdmackey@twitter.com: Rework control flow based on feedback from\ncl@linux.com, fix logic, and cleanup current task_struct reference]\nAcked-by: David Rientjes <rientjes@google.com>\nAcked-by: Christoph Lameter <cl@linux.com>\nAcked-by: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>\nSigned-off-by: David Mackey <tdmackey@twitter.com>\nSigned-off-by: Pekka Enberg <penberg@kernel.org>\nslab: rename gfpflags to allocflags\n\nA consistent name with slub saves us an acessor function.\nIn both caches, this field represents the same thing. We would\nlike to use it from the mem_cgroup code.\n\nSigned-off-by: Glauber Costa <glommer@parallels.com>\nAcked-by: Christoph Lameter <cl@linux.com>\nCC: Pekka Enberg <penberg@cs.helsinki.fi>\nSigned-off-by: Pekka Enberg <penberg@kernel.org>\nmm, slab: Build fix for recent kmem_cache changes\n\nCommit 3b0efdf (\"mm, sl[aou]b: Extract common fields from struct\nkmem_cache\") renamed the kmem_cache structure's \"next\" field to \"list\"\nbut forgot to update one instance in leaks_show().\n\nSigned-off-by: Thierry Reding <thierry.reding@avionic-design.de>\nSigned-off-by: Pekka Enberg <penberg@kernel.org>\nslab: Fix a typo in commit 8c138b \"slab: Get rid of obj_size macro\"\n\nCommit  8c138b only sits in Pekka's and linux-next tree now, which tries\nto replace obj_size(cachep) with cachep->object_size, but has a typo in\nkmem_cache_free() by using \"size\" instead of \"object_size\", which casues\nsome regressions.\n\nReported-and-tested-by: Fengguang Wu <wfg@linux.intel.com>\nSigned-off-by: Feng Tang <feng.tang@intel.com>\nCc: Christoph Lameter <cl@linux.com>\nAcked-by: Glauber Costa <glommer@parallels.com>\nSigned-off-by: Pekka Enberg <penberg@kernel.org>\nslab: move FULL state transition to an initcall\n\nDuring kmem_cache_init_late(), we transition to the LATE state,\nand after some more work, to the FULL state, its last state\n\nThis is quite different from slub, that will only transition to\nits last state (previously SYSFS), in a (late)initcall, after a lot\nmore of the kernel is ready.\n\nThis means that in slab, we have no way to taking actions dependent\non the initialization of other pieces of the kernel that are supposed\nto start way after kmem_init_late(), such as cgroups initialization.\n\nTo achieve more consistency in this behavior, that patch only\ntransitions to the UP state in kmem_init_late. In my analysis,\nsetup_cpu_cache() should be happy to test for >= UP, instead of\n== FULL. It also has passed some tests I've made.\n\nWe then only mark FULL state after the reap timers are in place,\nmeaning that no further setup is expected.\n\nSigned-off-by: Glauber Costa <glommer@parallels.com>\nAcked-by: Christoph Lameter <cl@linux.com>\nAcked-by: David Rientjes <rientjes@google.com>\nSigned-off-by: Pekka Enberg <penberg@kernel.org>\nslub: use __cmpxchg_double_slab() at interrupt disabled place\n\nget_freelist(), unfreeze_partials() are only called with interrupt disabled,\nso __cmpxchg_double_slab() is suitable.\n\nAcked-by: Christoph Lameter <cl@linux.com>\nSigned-off-by: Joonsoo Kim <js1304@gmail.com>\nSigned-off-by: Pekka Enberg <penberg@kernel.org>\nslub: refactoring unfreeze_partials()\n\nCurrent implementation of unfreeze_partials() is so complicated,\nbut benefit from it is insignificant. In addition many code in\ndo {} while loop have a bad influence to a fail rate of cmpxchg_double_slab.\nUnder current implementation which test status of cpu partial slab\nand acquire list_lock in do {} while loop,\nwe don't need to acquire a list_lock and gain a little benefit\nwhen front of the cpu partial slab is to be discarded, but this is a rare case.\nIn case that add_partial is performed and cmpxchg_double_slab is failed,\nremove_partial should be called case by case.\n\nI think that these are disadvantages of current implementation,\nso I do refactoring unfreeze_partials().\n\nMinimizing code in do {} while loop introduce a reduced fail rate\nof cmpxchg_double_slab. Below is output of 'slabinfo -r kmalloc-256'\nwhen './perf stat -r 33 hackbench 50 process 4000 > /dev/null' is done.\n\n** before **\nCmpxchg_double Looping\n------------------------\nLocked Cmpxchg Double redos   182685\nUnlocked Cmpxchg Double redos 0\n\n** after **\nCmpxchg_double Looping\n------------------------\nLocked Cmpxchg Double redos   177995\nUnlocked Cmpxchg Double redos 1\n\nWe can see cmpxchg_double_slab fail rate is improved slightly.\n\nBolow is output of './perf stat -r 30 hackbench 50 process 4000 > /dev/null'.\n\n** before **\n Performance counter stats for './hackbench 50 process 4000' (30 runs):\n\n     108517.190463 task-clock                #    7.926 CPUs utilized            ( +-  0.24% )\n         2,919,550 context-switches          #    0.027 M/sec                    ( +-  3.07% )\n           100,774 CPU-migrations            #    0.929 K/sec                    ( +-  4.72% )\n           124,201 page-faults               #    0.001 M/sec                    ( +-  0.15% )\n   401,500,234,387 cycles                    #    3.700 GHz                      ( +-  0.24% )\n   <not supported> stalled-cycles-frontend\n   <not supported> stalled-cycles-backend\n   250,576,913,354 instructions              #    0.62  insns per cycle          ( +-  0.13% )\n    45,934,956,860 branches                  #  423.297 M/sec                    ( +-  0.14% )\n       188,219,787 branch-misses             #    0.41% of all branches          ( +-  0.56% )\n\n      13.691837307 seconds time elapsed                                          ( +-  0.24% )\n\n** after **\n Performance counter stats for './hackbench 50 process 4000' (30 runs):\n\n     107784.479767 task-clock                #    7.928 CPUs utilized            ( +-  0.22% )\n         2,834,781 context-switches          #    0.026 M/sec                    ( +-  2.33% )\n            93,083 CPU-migrations            #    0.864 K/sec                    ( +-  3.45% )\n           123,967 page-faults               #    0.001 M/sec                    ( +-  0.15% )\n   398,781,421,836 cycles                    #    3.700 GHz                      ( +-  0.22% )\n   <not supported> stalled-cycles-frontend\n   <not supported> stalled-cycles-backend\n   250,189,160,419 instructions              #    0.63  insns per cycle          ( +-  0.09% )\n    45,855,370,128 branches                  #  425.436 M/sec                    ( +-  0.10% )\n       169,881,248 branch-misses             #    0.37% of all branches          ( +-  0.43% )\n\n      13.596272341 seconds time elapsed                                          ( +-  0.22% )\n\nNo regression is found, but rather we can see slightly better result.\n\nAcked-by: Christoph Lameter <cl@linux.com>\nSigned-off-by: Joonsoo Kim <js1304@gmail.com>\nSigned-off-by: Pekka Enberg <penberg@kernel.org>\nslub: remove invalid reference to list iterator variable\n\nIf list_for_each_entry, etc complete a traversal of the list, the iterator\nvariable ends up pointing to an address at an offset from the list head,\nand not a meaningful structure.  Thus this value should not be used after\nthe end of the iterator.  The patch replaces s->name by al->name, which is\nreferenced nearby.\n\nThis problem was found using Coccinelle (http://coccinelle.lip6.fr/).\n\nSigned-off-by: Julia Lawall <Julia.Lawall@lip6.fr>\nSigned-off-by: Pekka Enberg <penberg@kernel.org>\nmm, sl[aou]b: Common definition for boot state of the slab allocators\n\nAll allocators have some sort of support for the bootstrap status.\n\nSetup a common definition for the boot states and make all slab\nallocators use that definition.\n\nReviewed-by: Glauber Costa <glommer@parallels.com>\nReviewed-by: Joonsoo Kim <js1304@gmail.com>\nSigned-off-by: Christoph Lameter <cl@linux.com>\nSigned-off-by: Pekka Enberg <penberg@kernel.org>\nmm, sl[aou]b: Use a common mutex definition\n\nUse the mutex definition from SLAB and make it the common way to take a sleeping lock.\n\nThis has the effect of using a mutex instead of a rw semaphore for SLUB.\n\nSLOB gains the use of a mutex for kmem_cache_create serialization.\nNot needed now but SLOB may acquire some more features later (like slabinfo\n/ sysfs support) through the expansion of the common code that will\nneed this.\n\nReviewed-by: Glauber Costa <glommer@parallels.com>\nReviewed-by: Joonsoo Kim <js1304@gmail.com>\nSigned-off-by: Christoph Lameter <cl@linux.com>\nSigned-off-by: Pekka Enberg <penberg@kernel.org>\n\nSigned-off-by: Paul Reioux <reioux@gmail.com>\nmm, sl[aou]b: Move kmem_cache_create mutex handling to common code\n\nMove the mutex handling into the common kmem_cache_create()\nfunction.\n\nThen we can also move more checks out of SLAB's kmem_cache_create()\ninto the common code.\n\nReviewed-by: Glauber Costa <glommer@parallels.com>\nSigned-off-by: Christoph Lameter <cl@linux.com>\nSigned-off-by: Pekka Enberg <penberg@kernel.org>\n\nSigned-off-by: Paul Reioux <reioux@gmail.com>\nmm, slub: ensure irqs are enabled for kmemcheck\n\nkmemcheck_alloc_shadow() requires irqs to be enabled, so wait to disable\nthem until after its called for __GFP_WAIT allocations.\n\nThis fixes a warning for such allocations:\n\n\tWARNING: at kernel/lockdep.c:2739 lockdep_trace_alloc+0x14e/0x1c0()\n\nAcked-by: Fengguang Wu <fengguang.wu@intel.com>\nAcked-by: Steven Rostedt <rostedt@goodmis.org>\nTested-by: Fengguang Wu <fengguang.wu@intel.com>\nSigned-off-by: David Rientjes <rientjes@google.com>\nSigned-off-by: Pekka Enberg <penberg@kernel.org>\nmm: sl[au]b: add knowledge of PFMEMALLOC reserve pages\n\nWhen a user or administrator requires swap for their application, they\ncreate a swap partition and file, format it with mkswap and activate it\nwith swapon.  Swap over the network is considered as an option in diskless\nsystems.  The two likely scenarios are when blade servers are used as part\nof a cluster where the form factor or maintenance costs do not allow the\nuse of disks and thin clients.\n\nThe Linux Terminal Server Project recommends the use of the Network Block\nDevice (NBD) for swap according to the manual at\nhttps://sourceforge.net/projects/ltsp/files/Docs-Admin-Guide/LTSPManual.pdf/download\nThere is also documentation and tutorials on how to setup swap over NBD at\nplaces like https://help.ubuntu.com/community/UbuntuLTSP/EnableNBDSWAP The\nnbd-client also documents the use of NBD as swap.  Despite this, the fact\nis that a machine using NBD for swap can deadlock within minutes if swap\nis used intensively.  This patch series addresses the problem.\nThe core issue is that network block devices do not use mempools like\nnormal block devices do.  As the host cannot control where they receive\npackets from, they cannot reliably work out in advance how much memory\nthey might need.  Some years ago, Peter Zijlstra developed a series of\npatches that supported swap over an NFS that at least one distribution is\ncarrying within their kernels.  This patch series borrows very heavily\nfrom Peter's work to support swapping over NBD as a pre-requisite to\nsupporting swap-over-NFS.  The bulk of the complexity is concerned with\npreserving memory that is allocated from the PFMEMALLOC reserves for use\nby the network layer which is needed for both NBD and NFS.\n\nPatch 1 adds knowledge of the PFMEMALLOC reserves to SLAB and SLUB to\n        preserve access to pages allocated under low memory situations\n        to callers that are freeing memory.\n\nPatch 2 optimises the SLUB fast path to avoid pfmemalloc checks\n\nPatch 3 introduces __GFP_MEMALLOC to allow access to the PFMEMALLOC\n        reserves without setting PFMEMALLOC.\n\nPatch 4 opens the possibility for softirqs to use PFMEMALLOC reserves        for later use by network packet processing.\n\nPatch 5 only sets page->pfmemalloc when ALLOC_NO_WATERMARKS was required\n\nPatch 6 ignores memory policies when ALLOC_NO_WATERMARKS is set.\n\nPatches 7-12 allows network processing to use PFMEMALLOC reserves when\n        the socket has been marked as being used by the VM to clean pages. If\n        packets are received and stored in pages that were allocated under\n        low-memory situations and are unrelated to the VM, the packets\n        are dropped.\n\n        Patch 11 reintroduces __skb_alloc_page which the networking\n        folk may object to but is needed in some cases to propogate\n        pfmemalloc from a newly allocated page to an skb. If there is a\n        strong objection, this patch can be dropped with the impact being\n        that swap-over-network will be slower in some cases but it should\n        not fail.\n\nPatch 13 is a micro-optimisation to avoid a function call in the\n        common case.\nPatch 14 tags NBD sockets as being SOCK_MEMALLOC so they can use\n        PFMEMALLOC if necessary.\n\nPatch 16 adds a statistic to track how often processes get throttled\n\nSome basic performance testing was run using kernel builds, netperf on\nloopback for UDP and TCP, hackbench (pipes and sockets), iozone and\nsysbench.  Each of them were expected to use the sl*b allocators\nreasonably heavily but there did not appear to be significant performance\nvariances.\n\nFor testing swap-over-NBD, a machine was booted with 2G of RAM with a\nswapfile backed by NBD.  8*NUM_CPU processes were started that create\nanonymous memory mappings and read them linearly in a loop.  The total\nsize of the mappings were 4*PHYSICAL_MEMORY to use swap heavily under\nmemory pressure.\n\nWithout the patches and using SLUB, the machine locks up within minutes\nand runs to completion with them applied.  With SLAB, the story is\ndifferent as an unpatched kernel run to completion.  However, the patched\nkernel completed the test 45% faster.\n\nMICRO\n                                         3.5.0-rc2 3.5.0-rc2\n                                         vanilla     swapnbd\nUnrecognised test vmscan-anon-mmap-write\nMMTests Statistics: duration\nSys Time Running Test (seconds)             197.80    173.07\nUser+Sys Time Running Test (seconds)        206.96    182.03\nTotal Elapsed Time (seconds)               3240.70   1762.09\n\nThis patch: mm: sl[au]b: add knowledge of PFMEMALLOC reserve pages\n\nAllocations of pages below the min watermark run a risk of the machine\nhanging due to a lack of memory.  To prevent this, only callers who have\nPF_MEMALLOC or TIF_MEMDIE set and are not processing an interrupt are\nallowed to allocate with ALLOC_NO_WATERMARKS.  Once they are allocated to\na slab though, nothing prevents other callers consuming free objects\nwithin those slabs.  This patch limits access to slab pages that were\nalloced from the PFMEMALLOC reserves.\n\nWhen this patch is applied, pages allocated from below the low watermark\nare returned with page->pfmemalloc set and it is up to the caller to\ndetermine how the page should be protected.  SLAB restricts access to any\npage with page->pfmemalloc set to callers which are known to able to\naccess the PFMEMALLOC reserve.  If one is not available, an attempt is\nmade to allocate a new page rather than use a reserve.  SLUB is a bit more\nrelaxed in that it only records if the current per-CPU page was allocated\nfrom PFMEMALLOC reserve and uses another partial slab if the caller does\nnot have the necessary GFP or process flags.  This was found to be\nsufficient in tests to avoid hangs due to SLUB generally maintaining\nsmaller lists than SLAB.\n\nIn low-memory conditions it does mean that !PFMEMALLOC allocators can fail\na slab allocation even though free objects are available because they are\nbeing preserved for callers that are freeing pages.\n\n[a.p.zijlstra@chello.nl: Original implementation]\n[sebastian@breakpoint.cc: Correct order of page flag clearing]\nSigned-off-by: Mel Gorman <mgorman@suse.de>\nCc: David Miller <davem@davemloft.net>\nCc: Neil Brown <neilb@suse.de>\nCc: Peter Zijlstra <a.p.zijlstra@chello.nl>\nCc: Mike Christie <michaelc@cs.wisc.edu>\nCc: Eric B Munson <emunson@mgebm.net>\nCc: Eric Dumazet <eric.dumazet@gmail.com>\nCc: Sebastian Andrzej Siewior <sebastian@breakpoint.cc>\nCc: Mel Gorman <mgorman@suse.de>\nCc: Christoph Lameter <cl@linux.com>\nSigned-off-by: Andrew Morton <akpm@linux-foundation.org>\nSigned-off-by: Linus Torvalds <torvalds@linux-foundation.org>\n\nbackported for Android Linux 3.4 by faux123\n\nSigned-off-by: Paul Reioux <reioux@gmail.com>\nmm: slub: optimise the SLUB fast path to avoid pfmemalloc checks\n\nThis patch removes the check for pfmemalloc from the alloc hotpath and\nputs the logic after the election of a new per cpu slab.  For a pfmemalloc\npage we do not use the fast path but force the use of the slow path which\nis also used for the debug case.\n\nThis has the side-effect of weakening pfmemalloc processing in the\nfollowing way;\n\n1. A process that is allocating for network swap calls __slab_alloc.\n   pfmemalloc_match is true so the freelist is loaded and c->freelist is\n   now pointing to a pfmemalloc page.\n\n2. A process that is attempting normal allocations calls slab_alloc,\n   finds the pfmemalloc page on the freelist and uses it because it did\n   not check pfmemalloc_match()\n\nThe patch allows non-pfmemalloc allocations to use pfmemalloc pages with\nthe kmalloc slabs being the most vunerable caches on the grounds they\nare most likely to have a mix of pfmemalloc and !pfmemalloc requests. A\nlater patch will still protect the system as processes will get throttled\nif the pfmemalloc reserves get depleted but performance will not degrade\nas smoothly.\n\n[mgorman@suse.de: Expanded changelog]\nSigned-off-by: Christoph Lameter <cl@linux.com>\nSigned-off-by: Mel Gorman <mgorman@suse.de>\nCc: David Miller <davem@davemloft.net>\nCc: Neil Brown <neilb@suse.de>\nCc: Peter Zijlstra <a.p.zijlstra@chello.nl>\nCc: Mike Christie <michaelc@cs.wisc.edu>\nCc: Eric B Munson <emunson@mgebm.net>\nCc: Eric Dumazet <eric.dumazet@gmail.com>\nCc: Sebastian Andrzej Siewior <sebastian@breakpoint.cc>\nCc: Mel Gorman <mgorman@suse.de>\nSigned-off-by: Andrew Morton <akpm@linux-foundation.org>\nSigned-off-by: Linus Torvalds <torvalds@linux-foundation.org>\nslub: use free_page instead of put_page for freeing kmalloc allocation\n\nWhen freeing objects, the slub allocator will most of the time free\nempty pages by calling __free_pages(). But high-order kmalloc will be\ndiposed by means of put_page() instead. It makes no sense to call\nput_page() in kernel pages that are provided by the object allocators,\nso we shouldn't be doing this ourselves. Aside from the consistency\nchange, we don't change the flow too much. put_page()'s would call its\ndtor function, which is __free_pages. We also already do all of the\nCompound page tests ourselves, and the Mlock test we lose don't really\nmatter.\n\nSigned-off-by: Glauber Costa <glommer@parallels.com>\nAcked-by: Christoph Lameter <cl@linux.com>\nCC: David Rientjes <rientjes@google.com>\nCC: Pekka Enberg <penberg@kernel.org>\nSigned-off-by: Pekka Enberg <penberg@kernel.org>\nslub: Take node lock during object free checks\n\nOnly applies to scenarios where debugging is on:\n\nValidation of slabs can currently occur while debugging\ninformation is updated from the fast paths of the allocator.\nThis results in various races where we get false reports about\nslab metadata not being in order.\n\nThis patch makes the fast paths take the node lock so that\nserialization with slab validation will occur. Causes additional\nslowdown in debug scenarios.\n\nReported-by: Waiman Long <Waiman.Long@hp.com>\nSigned-off-by: Christoph Lameter <cl@linux.com>\nSigned-off-by: Pekka Enberg <penberg@kernel.org>\nslub: reduce failure of this_cpu_cmpxchg in put_cpu_partial() after unfreezing\n\nIn current implementation, after unfreezing, we doesn't touch oldpage,\nso it remain 'NOT NULL'. When we call this_cpu_cmpxchg()\nwith this old oldpage, this_cpu_cmpxchg() is mostly be failed.\n\nWe can change value of oldpage to NULL after unfreezing,\nbecause unfreeze_partial() ensure that all the cpu partial slabs is removed\nfrom cpu partial list. In this time, we could expect that\nthis_cpu_cmpxchg is mostly succeed.\n\nAcked-by: Christoph Lameter <cl@linux.com>\nSigned-off-by: Joonsoo Kim <js1304@gmail.com>\nSigned-off-by: Pekka Enberg <penberg@kernel.org>\nmm/slub: Add debugging to verify correct cache use on kmem_cache_free()\n\nAdd additional debugging to check that the objects is actually from the cache\nthe caller claims. Doing so currently trips up some other debugging code. It\ntakes a lot to infer from that what was happening.\n\nReviewed-by: Glauber Costa <glommer@parallels.com>\nSigned-off-by: Christoph Lameter <cl@linux.com>\n[ penberg@kernel.org: Use pr_err() ]\nSigned-off-by: Pekka Enberg <penberg@kernel.org>\nmm/slub: Use kmem_cache for the kmem_cache structure\n\nDo not use kmalloc() but kmem_cache_alloc() for the allocation\nof the kmem_cache structures in slub.\n\nReviewed-by: Glauber Costa <glommer@parallels.com>\nAcked-by: David Rientjes <rientjes@google.com>\nSigned-off-by: Christoph Lameter <cl@linux.com>\nSigned-off-by: Pekka Enberg <penberg@kernel.org>\nbackported for Linux 3.4\n\nSigned-off-by: Paul Reioux <reioux@gmail.com>\nmm: introduce __GFP_MEMALLOC to allow access to\n emergency reserves\n\n__GFP_MEMALLOC will allow the allocation to disregard the watermarks, much\nlike PF_MEMALLOC.  It allows one to pass along the memalloc state in\nobject related allocation flags as opposed to task related flags, such as\nsk->sk_allocation.  This removes the need for ALLOC_PFMEMALLOC as callers\nusing __GFP_MEMALLOC can get the ALLOC_NO_WATERMARK flag which is now\nenough to identify allocations related to page reclaim.\n\nSigned-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>\nSigned-off-by: Mel Gorman <mgorman@suse.de>\nCc: David Miller <davem@davemloft.net>\nCc: Neil Brown <neilb@suse.de>\nCc: Mike Christie <michaelc@cs.wisc.edu>\nCc: Eric B Munson <emunson@mgebm.net>\nCc: Eric Dumazet <eric.dumazet@gmail.com>\nCc: Sebastian Andrzej Siewior <sebastian@breakpoint.cc>\nCc: Mel Gorman <mgorman@suse.de>\nCc: Christoph Lameter <cl@linux.com>\nSigned-off-by: Andrew Morton <akpm@linux-foundation.org>\nSigned-off-by: Linus Torvalds <torvalds@linux-foundation.org>\n\nbackported to Android Linux 3.4 by faux123\n\nSigned-off-by: Paul Reioux <reioux@gmail.com>\nmm: micro-optimise slab to avoid a function call\n\nGetting and putting objects in SLAB currently requires a function call but\nthe bulk of the work is related to PFMEMALLOC reserves which are only\nconsumed when network-backed storage is critical.  Use an inline function\nto determine if the function call is required.\n\nSigned-off-by: Mel Gorman <mgorman@suse.de>\nCc: David Miller <davem@davemloft.net>\nCc: Neil Brown <neilb@suse.de>\nCc: Peter Zijlstra <a.p.zijlstra@chello.nl>\nCc: Mike Christie <michaelc@cs.wisc.edu>\nCc: Eric B Munson <emunson@mgebm.net>\nCc: Eric Dumazet <eric.dumazet@gmail.com>\nCc: Sebastian Andrzej Siewior <sebastian@breakpoint.cc>\nCc: Mel Gorman <mgorman@suse.de>\nCc: Christoph Lameter <cl@linux.com>\nSigned-off-by: Andrew Morton <akpm@linux-foundation.org>\nSigned-off-by: Linus Torvalds <torvalds@linux-foundation.org>\nslab: do not call compound_head() in page_get_cache()\n\npage_get_cache() does not need to call compound_head(), as its unique\ncaller virt_to_slab() already makes sure to return a head page.\n\nAdditionally, removing the compound_head() call makes page_get_cache()\nconsistent with page_get_slab().\n\nSigned-off-by: Michel Lespinasse <walken@google.com>\nCc: Christoph Lameter <cl@linux-foundation.org>\nCc: Pekka Enberg <penberg@kernel.org>\nAcked-by: David Rientjes <rientjes@google.com>\nSigned-off-by: Andrew Morton <akpm@linux-foundation.org>\nSigned-off-by: Pekka Enberg <penberg@kernel.org>\nmm, slab: remove page_get_cache\n\npage_get_cache() isn't called from anything, so remove it.\n\nSigned-off-by: David Rientjes <rientjes@google.com>\nSigned-off-by: Pekka Enberg <penberg@kernel.org>\nmm, slab: lock the correct nodelist after reenabling irqs\n\ncache_grow() can reenable irqs so the cpu (and node) can change, so ensure\nthat we take list_lock on the correct nodelist.\n\nThis fixes an issue with commit 072bb0aa5e06 (\"mm: sl[au]b: add\nknowledge of PFMEMALLOC reserve pages\") where list_lock for the wrong\nnode was taken after growing the cache.\n\nReported-and-tested-by: Haggai Eran <haggaie@mellanox.com>\nSigned-off-by: David Rientjes <rientjes@google.com>\nSigned-off-by: Linus Torvalds <torvalds@linux-foundation.org>\nmm: Fix build warning in kmem_cache_create()\n\nThe label oops is used in CONFIG_DEBUG_VM ifdef block and is defined\noutside ifdef CONFIG_DEBUG_VM block. This results in the following\nbuild warning when built with CONFIG_DEBUG_VM disabled. Fix to move\nlabel oops definition to inside a CONFIG_DEBUG_VM block.\n\nmm/slab_common.c: In function ‘kmem_cache_create’:\nmm/slab_common.c:101:1: warning: label ‘oops’ defined but not used\n[-Wunused-label]\n\nSigned-off-by: Shuah Khan <shuah.khan@hp.com>\nSigned-off-by: Pekka Enberg <penberg@kernel.org>\nSigned-off-by: Paul Reioux <reioux@gmail.com>\n\nConflicts:\n\tmm/slab_common.c\nmm/slab_common.c: cleanup\n\nEliminate an ifdef and a label by moving all the CONFIG_DEBUG_VM checking\ninside the locked region.\n\nCc: Pekka Enberg <penberg@cs.helsinki.fi>\nSigned-off-by: Andrew Morton <akpm@linux-foundation.org>\nSigned-off-by: Pekka Enberg <penberg@kernel.org>\nRevert \"mm/slab_common.c: cleanup\"\n\nThis reverts commit 455ce9eb1cfa083da0def023094190aeb133855a. Andrew\nsent a better version.\n\nSigned-off-by: Pekka Enberg <penberg@kernel.org>\nmm/slab: restructure kmem_cache_create() debug checks\n\nkmem_cache_create() does cache integrity checks when CONFIG_DEBUG_VM is\ndefined.  These checks interspersed with the regular code path has lead\nto compile time warnings when compiled without CONFIG_DEBUG_VM defined.\nRestructuring the code to move the integrity checks in to a new function\nwould eliminate the current compile warning problem and also will allow\nfor future changes to the debug only code to evolve without introducing\nnew warnings in the regular path.\n\nThis restructuring work is based on the discussion in the following\nthread:\n\nhttps://lkml.org/lkml/2012/7/13/424\n\n[akpm@linux-foundation.org: fix build, cleanup]\nSigned-off-by: Shuah Khan <shuah.khan@hp.com>\nAcked-by: Christoph Lameter <cl@linux.com>\nSigned-off-by: Andrew Morton <akpm@linux-foundation.org>\nSigned-off-by: Pekka Enberg <penberg@kernel.org>\nmm/slab_common: Improve error handling in kmem_cache_create\n\nInstead of using s == NULL use an errorcode. This allows much more\ndetailed diagnostics as to what went wrong. As we add more functionality\nfrom the slab allocators to the common kmem_cache_create() function we will\nalso add more error conditions.\n\nPrint the error code during the panic as well as in a warning if the module\ncan handle failure. The API for kmem_cache_create() currently does not allow\nthe returning of an error code. Return NULL but log the cause of the problem\nin the syslog.\n\nReviewed-by: Glauber Costa <glommer@parallels.com>\nAcked-by: David Rientjes <rientjes@google.com>\nSigned-off-by: Christoph Lameter <cl@linux.com>\nSigned-off-by: Pekka Enberg <penberg@kernel.org>\nmm/sl[aou]b: Move list_add() to slab_common.c\n\nMove the code to append the new kmem_cache to the list of slab caches to\nthe kmem_cache_create code in the shared code.\n\nThis is possible now since the acquisition of the mutex was moved into\nkmem_cache_create().\n\nAcked-by: David Rientjes <rientjes@google.com>\nReviewed-by: Glauber Costa <glommer@parallels.com>\nReviewed-by: Joonsoo Kim <js1304@gmail.com>\nSigned-off-by: Christoph Lameter <cl@linux.com>\nSigned-off-by: Pekka Enberg <penberg@kernel.org>\n\nSigned-off-by: Paul Reioux <reioux@gmail.com>\nmm/sl[aou]b: Use \"kmem_cache\" name for slab cache with kmem_cache struct\n\nMake all allocators use the \"kmem_cache\" slabname for the \"kmem_cache\"\nstructure.\n\nReviewed-by: Glauber Costa <glommer@parallels.com>\nReviewed-by: Joonsoo Kim <js1304@gmail.com>\nSigned-off-by: Christoph Lameter <cl@linux.com>\nSigned-off-by: Pekka Enberg <penberg@kernel.org>\nmm/sl[aou]b: Extract a common function for kmem_cache_destroy\n\nkmem_cache_destroy does basically the same in all allocators.\n\nExtract common code which is easy since we already have common mutex\nhandling.\n\nReviewed-by: Glauber Costa <glommer@parallels.com>\nSigned-off-by: Christoph Lameter <cl@linux.com>\nSigned-off-by: Pekka Enberg <penberg@kernel.org>\nmm/sl[aou]b: Move freeing of kmem_cache structure to common code\n\nThe freeing action is basically the same in all slab allocators.\nMove to the common kmem_cache_destroy() function.\n\nReviewed-by: Glauber Costa <glommer@parallels.com>\nReviewed-by: Joonsoo Kim <js1304@gmail.com>\nSigned-off-by: Christoph Lameter <cl@linux.com>\nSigned-off-by: Pekka Enberg <penberg@kernel.org>\nmm/sl[aou]b: Get rid of __kmem_cache_destroy\n\nWhat is done there can be done in __kmem_cache_shutdown.\n\nThis affects RCU handling somewhat. On rcu free all slab allocators do\nnot refer to other management structures than the kmem_cache structure.\nTherefore these other structures can be freed before the rcu deferred\nfree to the page allocator occurs.\n\nReviewed-by: Joonsoo Kim <js1304@gmail.com>\nSigned-off-by: Christoph Lameter <cl@linux.com>\nSigned-off-by: Pekka Enberg <penberg@kernel.org>\nmm/sl[aou]b: Move duping of slab name to slab_common.c\n\nDuping of the slabname has to be done by each slab. Moving this code to\nslab_common avoids duplicate implementations.\n\nWith this patch we have common string handling for all slab allocators.\nStrings passed to kmem_cache_create() are copied internally. Subsystems\ncan create temporary strings to create slab caches.\n\nSlabs allocated in early states of bootstrap will never be freed (and\nthose can never be freed since they are essential to slab allocator\noperations).  During bootstrap we therefore do not have to worry about\nduping names.\n\nReviewed-by: Glauber Costa <glommer@parallels.com>\nSigned-off-by: Christoph Lameter <cl@linux.com>\nSigned-off-by: Pekka Enberg <penberg@kernel.org>\n\nSigned-off-by: Paul Reioux <reioux@gmail.com>\nmm/sl[aou]b: Do slab aliasing call from common code\n\nThe slab aliasing logic causes some strange contortions in slub. So add\na call to deal with aliases to slab_common.c but disable it for other\nslab allocators by providng stubs that fail to create aliases.\n\nFull general support for aliases will require additional cleanup passes\nand more standardization of fields in kmem_cache.\n\nSigned-off-by: Christoph Lameter <cl@linux.com>\nSigned-off-by: Pekka Enberg <penberg@kernel.org>\nmm/sl[aou]b: Move sysfs_slab_add to common\n\nSimplify locking by moving the slab_add_sysfs after all locks have been\ndropped. Eases the upcoming move to provide sysfs support for all\nallocators.\n\nReviewed-by: Glauber Costa <glommer@parallels.com>\nSigned-off-by: Christoph Lameter <cl@linux.com>\nSigned-off-by: Pekka Enberg <penberg@kernel.org>\nmm/sl[aou]b: Move kmem_cache allocations into common code\n\nShift the allocations to common code. That way the allocation and\nfreeing of the kmem_cache structures is handled by common code.\n\nReviewed-by: Glauber Costa <glommer@parallels.com>\nSigned-off-by: Christoph Lameter <cl@linux.com>\nSigned-off-by: Pekka Enberg <penberg@kernel.org>\nmm/sl[aou]b: Shrink __kmem_cache_create() parameter lists\n\nDo the initial settings of the fields in common code. This will allow us\nto push more processing into common code later and improve readability.\n\nSigned-off-by: Christoph Lameter <cl@linux.com>\nSigned-off-by: Pekka Enberg <penberg@kernel.org>\nmm/sl[aou]b: Move kmem_cache refcounting to common code\n\nGet rid of the refcount stuff in the allocators and do that part of\nkmem_cache management in the common code.\n\nSigned-off-by: Christoph Lameter <cl@linux.com>\nSigned-off-by: Pekka Enberg <penberg@kernel.org>\nRevert \"mm/sl[aou]b: Move sysfs_slab_add to common\"\n\nThis reverts commit 96d17b7be0a9849d381442030886211dbb2a7061 which\ncaused the following errors at boot:\n\n  [    1.114885] kobject (ffff88001a802578): tried to init an initialized object, something is seriously wrong.\n  [    1.114885] Pid: 1, comm: swapper/0 Tainted: G        W    3.6.0-rc1+ #6\n  [    1.114885] Call Trace:\n  [    1.114885]  [<ffffffff81273f37>] kobject_init+0x87/0xa0\n  [    1.115555]  [<ffffffff8127426a>] kobject_init_and_add+0x2a/0x90\n  [    1.115555]  [<ffffffff8127c870>] ? sprintf+0x40/0x50\n  [    1.115555]  [<ffffffff81124c60>] sysfs_slab_add+0x80/0x210\n  [    1.115555]  [<ffffffff81100175>] kmem_cache_create+0xa5/0x250\n  [    1.115555]  [<ffffffff81cf24cd>] ? md_init+0x144/0x144\n  [    1.115555]  [<ffffffff81cf25b6>] local_init+0xa4/0x11b\n  [    1.115555]  [<ffffffff81cf24e1>] dm_init+0x14/0x45\n  [    1.115836]  [<ffffffff810001ba>] do_one_initcall+0x3a/0x160\n  [    1.116834]  [<ffffffff81cc2c90>] kernel_init+0x133/0x1b7\n  [    1.117835]  [<ffffffff81cc25c4>] ? do_early_param+0x86/0x86\n  [    1.117835]  [<ffffffff8171aff4>] kernel_thread_helper+0x4/0x10\n  [    1.118401]  [<ffffffff81cc2b5d>] ? start_kernel+0x33f/0x33f\n  [    1.119832]  [<ffffffff8171aff0>] ? gs_change+0xb/0xb\n  [    1.120325] ------------[ cut here ]------------\n  [    1.120835] WARNING: at fs/sysfs/dir.c:536 sysfs_add_one+0xc1/0xf0()\n  [    1.121437] sysfs: cannot create duplicate filename '/kernel/slab/:t-0000016'\n  [    1.121831] Modules linked in:\n  [    1.122138] Pid: 1, comm: swapper/0 Tainted: G        W    3.6.0-rc1+ #6\n  [    1.122831] Call Trace:\n  [    1.123074]  [<ffffffff81195ce1>] ? sysfs_add_one+0xc1/0xf0\n  [    1.123833]  [<ffffffff8103adfa>] warn_slowpath_common+0x7a/0xb0\n  [    1.124405]  [<ffffffff8103aed1>] warn_slowpath_fmt+0x41/0x50\n  [    1.124832]  [<ffffffff81195ce1>] sysfs_add_one+0xc1/0xf0\n  [    1.125337]  [<ffffffff81195eb3>] create_dir+0x73/0xd0\n  [    1.125832]  [<ffffffff81196221>] sysfs_create_dir+0x81/0xe0\n  [    1.126363]  [<ffffffff81273d3d>] kobject_add_internal+0x9d/0x210\n  [    1.126832]  [<ffffffff812742a3>] kobject_init_and_add+0x63/0x90\n  [    1.127406]  [<ffffffff81124c60>] sysfs_slab_add+0x80/0x210\n  [    1.127832]  [<ffffffff81100175>] kmem_cache_create+0xa5/0x250\n  [    1.128384]  [<ffffffff81cf24cd>] ? md_init+0x144/0x144\n  [    1.128833]  [<ffffffff81cf25b6>] local_init+0xa4/0x11b\n  [    1.129831]  [<ffffffff81cf24e1>] dm_init+0x14/0x45\n  [    1.130305]  [<ffffffff810001ba>] do_one_initcall+0x3a/0x160\n  [    1.130831]  [<ffffffff81cc2c90>] kernel_init+0x133/0x1b7\n  [    1.131351]  [<ffffffff81cc25c4>] ? do_early_param+0x86/0x86\n  [    1.131830]  [<ffffffff8171aff4>] kernel_thread_helper+0x4/0x10\n  [    1.132392]  [<ffffffff81cc2b5d>] ? start_kernel+0x33f/0x33f\n  [    1.132830]  [<ffffffff8171aff0>] ? gs_change+0xb/0xb\n  [    1.133315] ---[ end trace 2703540871c8fab7 ]---\n  [    1.133830] ------------[ cut here ]------------\n  [    1.134274] WARNING: at lib/kobject.c:196 kobject_add_internal+0x1f5/0x210()\n  [    1.134829] kobject_add_internal failed for :t-0000016 with -EEXIST, don't try to register things with the same name in the same directory.\n  [    1.135829] Modules linked in:\n  [    1.136135] Pid: 1, comm: swapper/0 Tainted: G        W    3.6.0-rc1+ #6\n  [    1.136828] Call Trace:\n  [    1.137071]  [<ffffffff81273e95>] ? kobject_add_internal+0x1f5/0x210\n  [    1.137830]  [<ffffffff8103adfa>] warn_slowpath_common+0x7a/0xb0\n  [    1.138402]  [<ffffffff8103aed1>] warn_slowpath_fmt+0x41/0x50\n  [    1.138830]  [<ffffffff811955a3>] ? release_sysfs_dirent+0x73/0xf0\n  [    1.139419]  [<ffffffff81273e95>] kobject_add_internal+0x1f5/0x210\n  [    1.139830]  [<ffffffff812742a3>] kobject_init_and_add+0x63/0x90\n  [    1.140429]  [<ffffffff81124c60>] sysfs_slab_add+0x80/0x210\n  [    1.140830]  [<ffffffff81100175>] kmem_cache_create+0xa5/0x250\n  [    1.141829]  [<ffffffff81cf24cd>] ? md_init+0x144/0x144\n  [    1.142307]  [<ffffffff81cf25b6>] local_init+0xa4/0x11b\n  [    1.142829]  [<ffffffff81cf24e1>] dm_init+0x14/0x45\n  [    1.143307]  [<ffffffff810001ba>] do_one_initcall+0x3a/0x160\n  [    1.143829]  [<ffffffff81cc2c90>] kernel_init+0x133/0x1b7\n  [    1.144352]  [<ffffffff81cc25c4>] ? do_early_param+0x86/0x86\n  [    1.144829]  [<ffffffff8171aff4>] kernel_thread_helper+0x4/0x10\n  [    1.145405]  [<ffffffff81cc2b5d>] ? start_kernel+0x33f/0x33f\n  [    1.145828]  [<ffffffff8171aff0>] ? gs_change+0xb/0xb\n  [    1.146313] ---[ end trace 2703540871c8fab8 ]---\n\nConflicts:\n\n\tmm/slub.c\n\nSigned-off-by: Pekka Enberg <penberg@kernel.org>\nslub: Zero initial memory segment for kmem_cache and kmem_cache_node\n\nTony Luck reported the following problem on IA-64:\n\n  Worked fine yesterday on next-20120905, crashes today. First sign of\n  trouble was an unaligned access, then a NULL dereference. SL*B related\n  bits of my config:\n\n  CONFIG_SLUB_DEBUG=y\n  # CONFIG_SLAB is not set\n  CONFIG_SLUB=y\n  CONFIG_SLABINFO=y\n  # CONFIG_SLUB_DEBUG_ON is not set\n  # CONFIG_SLUB_STATS is not set\n\n  And he console log.\n\n  PID hash table entries: 4096 (order: 1, 32768 bytes)\n  Dentry cache hash table entries: 262144 (order: 7, 2097152 bytes)\n  Inode-cache hash table entries: 131072 (order: 6, 1048576 bytes)\n  Memory: 2047920k/2086064k available (13992k code, 38144k reserved,\n  6012k data, 880k init)\n  kernel unaligned access to 0xca2ffc55fb373e95, ip=0xa0000001001be550\n  swapper[0]: error during unaligned kernel access\n   -1 [1]\n  Modules linked in:\n\n  Pid: 0, CPU 0, comm:              swapper\n  psr : 00001010084a2018 ifs : 800000000000060f ip  :\n  [<a0000001001be550>]    Not tainted (3.6.0-rc4-zx1-smp-next-20120906)\n  ip is at new_slab+0x90/0x680\n  unat: 0000000000000000 pfs : 000000000000060f rsc : 0000000000000003\n  rnat: 9666960159966a59 bsps: a0000001001441c0 pr  : 9666960159965a59\n  ldrs: 0000000000000000 ccv : 0000000000000000 fpsr: 0009804c8a70433f\n  csd : 0000000000000000 ssd : 0000000000000000\n  b0  : a0000001001be500 b6  : a00000010112cb20 b7  : a0000001011660a0\n  f6  : 0fff7f0f0f0f0e54f0000 f7  : 0ffe8c5c1000000000000\n  f8  : 1000d8000000000000000 f9  : 100068800000000000000\n  f10 : 10005f0f0f0f0e54f0000 f11 : 1003e0000000000000078\n  r1  : a00000010155eef0 r2  : 0000000000000000 r3  : fffffffffffc1638\n  r8  : e0000040600081b8 r9  : ca2ffc55fb373e95 r10 : 0000000000000000\n  r11 : e000004040001646 r12 : a000000101287e20 r13 : a000000101280000\n  r14 : 0000000000004000 r15 : 0000000000000078 r16 : ca2ffc55fb373e75\n  r17 : e000004040040000 r18 : fffffffffffc1646 r19 : e000004040001646\n  r20 : fffffffffffc15f8 r21 : 000000000000004d r22 : a00000010132fa68\n  r23 : 00000000000000ed r24 : 0000000000000000 r25 : 0000000000000000\n  r26 : 0000000000000001 r27 : a0000001012b8500 r28 : a00000010135f4a0\n  r29 : 0000000000000000 r30 : 0000000000000000 r31 : 0000000000000001\n  Unable to handle kernel NULL pointer dereference (address\n  0000000000000018)\n  swapper[0]: Oops 11003706212352 [2]\n  Modules linked in:\n\n  Pid: 0, CPU 0, comm:              swapper\n  psr : 0000121008022018 ifs : 800000000000cc18 ip  :\n  [<a0000001004dc8f1>]    Not tainted (3.6.0-rc4-zx1-smp-next-20120906)\n  ip is at __copy_user+0x891/0x960\n  unat: 0000000000000000 pfs : 0000000000000813 rsc : 0000000000000003\n  rnat: 0000000000000000 bsps: 0000000000000000 pr  : 9666960159961765\n  ldrs: 0000000000000000 ccv : 0000000000000000 fpsr: 0009804c0270033f\n  csd : 0000000000000000 ssd : 0000000000000000\n  b0  : a00000010004b550 b6  : a00000010004b740 b7  : a00000010000c750\n  f6  : 000000000000000000000 f7  : 1003e9e3779b97f4a7c16\n  f8  : 1003e0a00000010001550 f9  : 100068800000000000000\n  f10 : 10005f0f0f0f0e54f0000 f11 : 1003e0000000000000078\n  r1  : a00000010155eef0 r2  : a0000001012870b0 r3  : a0000001012870b8\n  r8  : 0000000000000298 r9  : 0000000000000013 r10 : 0000000000000000\n  r11 : 9666960159961a65 r12 : a000000101287010 r13 : a000000101280000\n  r14 : a000000101287068 r15 : a000000101287080 r16 : 0000000000000298\n  r17 : 0000000000000010 r18 : 0000000000000018 r19 : a000000101287310\n  r20 : 0000000000000290 r21 : 0000000000000000 r22 : 0000000000000000\n  r23 : a000000101386f58 r24 : 0000000000000000 r25 : 000000007fffffff\n  r26 : a000000101287078 r27 : a0000001013c69b0 r28 : 0000000000000000\n  r29 : 0000000000000014 r30 : 0000000000000000 r31 : 0000000000000813\n\nSedat Dilek and Hugh Dickins reported similar problems as well.\n\nEarlier patches in the common set moved the zeroing of the kmem_cache\nstructure into common code. See \"Move allocation of kmem_cache into\ncommon code\".\n\nThe allocation for the two special structures is still done from SLUB\nspecific code but no zeroing is done since the cache creation functions\nused to zero. This now needs to be updated so that the structures are\nzeroed during allocation in kmem_cache_init().  Otherwise random pointer\nvalues may be followed.\n\nReported-by: Tony Luck <tony.luck@intel.com>\nReported-by: Sedat Dilek <sedat.dilek@gmail.com>\nTested-by: Sedat Dilek <sedat.dilek@gmail.com>\nReported-by: Hugh Dickins <hughd@google.com>\nTested-by: Sedat Dilek <sedat.dilek@gmail.com>\nSigned-off-by: Christoph Lameter <cl@linux.com>\nSigned-off-by: Pekka Enberg <penberg@kernel.org>\nslub: consider pfmemalloc_match() in get_partial_node()\n\nget_partial() is currently not checking pfmemalloc_match() meaning that\nit is possible for pfmemalloc pages to leak to non-pfmemalloc users.\nThis is a problem in the following situation.  Assume that there is a\nrequest from normal allocation and there are no objects in the per-cpu\ncache and no node-partial slab.\n\nIn this case, slab_alloc enters the slow path and new_slab_objects() is\ncalled which may return a PFMEMALLOC page.  As the current user is not\nallowed to access PFMEMALLOC page, deactivate_slab() is called\n([5091b74a: mm: slub: optimise the SLUB fast path to avoid pfmemalloc\nchecks]) and returns an object from PFMEMALLOC page.\n\nNext time, when we get another request from normal allocation,\nslab_alloc() enters the slow-path and calls new_slab_objects().  In\nnew_slab_objects(), we call get_partial() and get a partial slab which\nwas just deactivated but is a pfmemalloc page.  We extract one object\nfrom it and re-deactivate.\n\n  \"deactivate -> re-get in get_partial -> re-deactivate\" occures repeatedly.\n\nAs a result, access to PFMEMALLOC page is not properly restricted and it\ncan cause a performance degradation due to frequent deactivation.\ndeactivation frequently.\n\nThis patch changes get_partial_node() to take pfmemalloc_match() into\naccount and prevents the \"deactivate -> re-get in get_partial()\nscenario.  Instead, new_slab() is called.\n\nSigned-off-by: Joonsoo Kim <js1304@gmail.com>\nAcked-by: David Rientjes <rientjes@google.com>\nSigned-off-by: Mel Gorman <mgorman@suse.de>\nCc: David Miller <davem@davemloft.net>\nCc: Chuck Lever <chuck.lever@oracle.com>\nCc: Pekka Enberg <penberg@kernel.org>\nSigned-off-by: Andrew Morton <akpm@linux-foundation.org>\nSigned-off-by: Linus Torvalds <torvalds@linux-foundation.org>\nslab: fix the DEADLOCK issue on l3 alien lock\n\nDEADLOCK will be report while running a kernel with NUMA and LOCKDEP enabled,\nthe process of this fake report is:\n\n\t   kmem_cache_free()\t//free obj in cachep\n\t-> cache_free_alien()\t//acquire cachep's l3 alien lock\n\t-> __drain_alien_cache()\n\t-> free_block()\n\t-> slab_destroy()\n\t-> kmem_cache_free()\t//free slab in cachep->slabp_cache\n\t-> cache_free_alien()\t//acquire cachep->slabp_cache's l3 alien lock\n\nSince the cachep and cachep->slabp_cache's l3 alien are in the same lock class,\nfake report generated.\n\nThis should not happen since we already have init_lock_keys() which will\nreassign the lock class for both l3 list and l3 alien.\n\nHowever, init_lock_keys() was invoked at a wrong position which is before we\ninvoke enable_cpucache() on each cache.\n\nSince until set slab_state to be FULL, we won't invoke enable_cpucache()\non caches to build their l3 alien while creating them, so although we invoked\ninit_lock_keys(), the l3 alien lock class won't change since we don't have\nthem until invoked enable_cpucache() later.\n\nThis patch will invoke init_lock_keys() after we done enable_cpucache()\ninstead of before to avoid the fake DEADLOCK report.\n\nMichael traced the problem back to a commit in release 3.0.0:\n\ncommit 30765b92ada267c5395fc788623cb15233276f5c\nAuthor: Peter Zijlstra <peterz@infradead.org>\nDate:   Thu Jul 28 23:22:56 2011 +0200\n\n    slab, lockdep: Annotate the locks before using them\n\n    Fernando found we hit the regular OFF_SLAB 'recursion' before we\n    annotate the locks, cure this.\n\n    The relevant portion of the stack-trace:\n\n    > [    0.000000]  [<c085e24f>] rt_spin_lock+0x50/0x56\n    > [    0.000000]  [<c04fb406>] __cache_free+0x43/0xc3\n    > [    0.000000]  [<c04fb23f>] kmem_cache_free+0x6c/0xdc\n    > [    0.000000]  [<c04fb2fe>] slab_destroy+0x4f/0x53\n    > [    0.000000]  [<c04fb396>] free_block+0x94/0xc1\n    > [    0.000000]  [<c04fc551>] do_tune_cpucache+0x10b/0x2bb\n    > [    0.000000]  [<c04fc8dc>] enable_cpucache+0x7b/0xa7\n    > [    0.000000]  [<c0bd9d3c>] kmem_cache_init_late+0x1f/0x61\n    > [    0.000000]  [<c0bba687>] start_kernel+0x24c/0x363\n    > [    0.000000]  [<c0bba0ba>] i386_start_kernel+0xa9/0xaf\n\n    Reported-by: Fernando Lopez-Lezcano <nando@ccrma.Stanford.EDU>\n    Acked-by: Pekka Enberg <penberg@kernel.org>\n    Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>\n    Link: http://lkml.kernel.org/r/1311888176.2617.379.camel@laptop\n    Signed-off-by: Ingo Molnar <mingo@elte.hu>\n\nThe commit moved init_lock_keys() before we build up the alien, so we\nfailed to reclass it.\n\nCc: <stable@vger.kernel.org> # 3.0+\nAcked-by: Christoph Lameter <cl@linux.com>\nTested-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>\nSigned-off-by: Michael Wang <wangyun@linux.vnet.ibm.com>\nSigned-off-by: Pekka Enberg <penberg@kernel.org>\nslab: do ClearSlabPfmemalloc() for all pages of slab\n\nRight now, we call ClearSlabPfmemalloc() for first page of slab when we\nclear SlabPfmemalloc flag.  This is fine for most swap-over-network use\ncases as it is expected that order-0 pages are in use.  Unfortunately it\nis possible that that __ac_put_obj() checks SlabPfmemalloc on a tail\npage and while this is harmless, it is sloppy.  This patch ensures that\nthe head page is always used.\n\nThis problem was originally identified by Joonsoo Kim.\n\n[js1304@gmail.com: Original implementation and problem identification]\nSigned-off-by: Mel Gorman <mgorman@suse.de>\nCc: David Miller <davem@davemloft.net>\nCc: Chuck Lever <chuck.lever@oracle.com>\nCc: Joonsoo Kim <js1304@gmail.com>\nCc: David Rientjes <rientjes@google.com>\nCc: Pekka Enberg <penberg@kernel.org>\nSigned-off-by: Andrew Morton <akpm@linux-foundation.org>\nSigned-off-by: Linus Torvalds <torvalds@linux-foundation.org>\nslab: fix starting index for finding another object\n\nIn array cache, there is a object at index 0, check it.\n\nSigned-off-by: Joonsoo Kim <js1304@gmail.com>\nSigned-off-by: Mel Gorman <mgorman@suse.de>\nCc: David Miller <davem@davemloft.net>\nCc: Chuck Lever <chuck.lever@oracle.com>\nCc: David Rientjes <rientjes@google.com>\nCc: Pekka Enberg <penberg@kernel.org>\nSigned-off-by: Andrew Morton <akpm@linux-foundation.org>\nSigned-off-by: Linus Torvalds <torvalds@linux-foundation.org>\nslab: Only define slab_error for DEBUG\n\nOn Tue, 11 Sep 2012, Stephen Rothwell wrote:\n> After merging the final tree, today's linux-next build (sparc64 defconfig)\n> produced this warning:\n>\n> mm/slab.c:808:13: warning: '__slab_error' defined but not used [-Wunused-function]\n>\n> Introduced by commit 945cf2b6199b (\"mm/sl[aou]b: Extract a common\n> function for kmem_cache_destroy\").  All uses of slab_error() are now\n> guarded by DEBUG.\n\nThere is no use case left for slab builds without DEBUG.\n\nSigned-off-by: Christoph Lameter <cl@linux.com>\nSigned-off-by: Pekka Enberg <penberg@kernel.org>\nmm, sl[au]b: Taint kernel when we detect a corrupted slab\n\nIt doesn't seem worth adding a new taint flag for this, so just re-use\nthe one from 'bad page'\n\nAcked-by: Christoph Lameter <cl@linux.com> # SLUB\nAcked-by: David Rientjes <rientjes@google.com>\nSigned-off-by: Dave Jones <davej@redhat.com>\nSigned-off-by: Pekka Enberg <penberg@kernel.org>\nmm, slub: Rename slab_alloc() -> slab_alloc_node() to match SLAB\n\nThis patch does not fix anything, and its only goal is to enable us\nto obtain some common code between SLAB and SLUB.\nNeither behavior nor produced code is affected.\n\nCc: Christoph Lameter <cl@linux.com>\nSigned-off-by: Ezequiel Garcia <elezegarcia@gmail.com>\nSigned-off-by: Pekka Enberg <penberg@kernel.org>\nslub: init_kmem_cache_cpus() and put_cpu_partial() can be static\n\nAcked-by: Glauber Costa <glommer@parallels.com>\nAcked-by: Christoph Lameter <cl@linux.com>\nAcked-by: David Rientjes <rientjes@google.com>\nSigned-off-by: Fengguang Wu <fengguang.wu@intel.com>\nSigned-off-by: Pekka Enberg <penberg@kernel.org>\nslub: remove one code path and reduce lock contention in __slab_free()\n\nWhen we try to free object, there is some of case that we need\nto take a node lock. This is the necessary step for preventing a race.\nAfter taking a lock, then we try to cmpxchg_double_slab().\nBut, there is a possible scenario that cmpxchg_double_slab() is failed\nwith taking a lock. Following example explains it.\n\nCPU A               CPU B\nneed lock\n...                 need lock\n...                 lock!!\nlock..but spin      free success\nspin...             unlock\nlock!!\nfree fail\n\nIn this case, retry with taking a lock is occured in CPU A.\nI think that in this case for CPU A,\n\"release a lock first, and re-take a lock if necessary\" is preferable way.\n\nThere are two reasons for this.\n\nFirst, this makes __slab_free()'s logic somehow simple.\nWith this patch, 'was_frozen = 1' is \"always\" handled without taking a lock.\nSo we can remove one code path.\n\nSecond, it may reduce lock contention.\nWhen we do retrying, status of slab is already changed,\nso we don't need a lock anymore in almost every case.\n\"release a lock first, and re-take a lock if necessary\" policy is\nhelpful to this.\n\nSigned-off-by: Joonsoo Kim <js1304@gmail.com>\nAcked-by: Christoph Lameter <cl@linux.com>\nSigned-off-by: Pekka Enberg <penberg@kernel.org>\nmm, slab: Remove silly function slab_buffer_size()\n\nThis function is seldom used, and can be simply replaced with cachep->size.\n\nAcked-by: David Rientjes <rientjes@google.com>\nSigned-off-by: Ezequiel Garcia <elezegarcia@gmail.com>\nSigned-off-by: Pekka Enberg <penberg@kernel.org>\nmm, slab: Replace 'caller' type, void* -> unsigned long\n\nThis allows to use _RET_IP_ instead of builtin_address(0), thus\nachiveing implementation consistency in all three allocators.\nThough maybe a nitpick, the real goal behind this patch is\nto be able to obtain common code between SLAB and SLUB.\n\nSigned-off-by: Ezequiel Garcia <elezegarcia@gmail.com>\nSigned-off-by: Pekka Enberg <penberg@kernel.org>\nmm, slab: Match SLAB and SLUB kmem_cache_alloc_xxx_trace() prototype\n\nThis long (seemingly unnecessary) patch does not fix anything and\nits only goal is to produce common code between SLAB and SLUB.\n\nCc: Christoph Lameter <cl@linux.com>\nSigned-off-by: Ezequiel Garcia <elezegarcia@gmail.com>\nSigned-off-by: Pekka Enberg <penberg@kernel.org>\nmm, slab: Rename __cache_alloc() -> slab_alloc()\n\nThis patch does not fix anything and its only goal is to\nproduce common code between SLAB and SLUB.\n\nCc: Christoph Lameter <cl@linux.com>\nSigned-off-by: Ezequiel Garcia <elezegarcia@gmail.com>\nSigned-off-by: Pekka Enberg <penberg@kernel.org>\nmm/slab: Fix typo _RET_IP -> _RET_IP_\n\nThe bug was introduced by commit 7c0cb9c64f83 (\"mm, slab: Replace\n'caller' type, void* -> unsigned long\").\n\nReported-by: Fengguang Wu <fengguang.wu@intel.com>\nSigned-off-by: Ezequiel Garcia <elezegarcia@gmail.com>\nSigned-off-by: Pekka Enberg <penberg@kernel.org>\nmm/slab: Fix kmem_cache_alloc_node_trace() declaration\n\nThe bug was introduced in commit 4052147c0afa (\"mm, slab: Match SLAB\nand SLUB kmem_cache_alloc_xxx_trace() prototype\").\n\nReported-by: Fengguang Wu <fengguang.wu@intel.com>\nSigned-off-by: Ezequiel Garcia <elezegarcia@gmail.com>\nSigned-off-by: Pekka Enberg <penberg@kernel.org>\nRevert \"mm/slab: Fix kmem_cache_alloc_node_trace() declaration\"\n\nThis reverts commit 1e5965bf1f018cc30a4659fa3f1a40146e4276f6. Ezequiel\nGarcia has a better fix.\nslab: Fix build failure in __kmem_cache_create()\n\nFix build failure with CONFIG_DEBUG_SLAB=y && CONFIG_DEBUG_PAGEALLOC=y caused\nby commit 8a13a4cc \"mm/sl[aou]b: Shrink __kmem_cache_create() parameter lists\".\n\nmm/slab.c: In function '__kmem_cache_create':\nmm/slab.c:2474: error: 'align' undeclared (first use in this function)\nmm/slab.c:2474: error: (Each undeclared identifier is reported only once\nmm/slab.c:2474: error: for each function it appears in.)\nmake[1]: *** [mm/slab.o] Error 1\nmake: *** [mm] Error 2\n\nAcked-by: Christoph Lameter <cl@linux.com>\nSigned-off-by: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>\nSigned-off-by: Pekka Enberg <penberg@kernel.org>\nmm, slab: release slab_mutex earlier in kmem_cache_destroy()\n\nCommit 1331e7a1bbe1 (\"rcu: Remove _rcu_barrier() dependency on\n__stop_machine()\") introduced slab_mutex -> cpu_hotplug.lock dependency\nthrough kmem_cache_destroy() -> rcu_barrier() -> _rcu_barrier() ->\nget_online_cpus().\n\nLockdep thinks that this might actually result in ABBA deadlock,\nand reports it as below:\n\n=== [ cut here ] ===\n ======================================================\n [ INFO: possible circular locking dependency detected ]\n 3.6.0-rc5-00004-g0d8ee37 #143 Not tainted\n -------------------------------------------------------\n kworker/u:2/40 is trying to acquire lock:\n  (rcu_sched_state.barrier_mutex){+.+...}, at: [<ffffffff810f2126>] _rcu_barrier+0x26/0x1e0\n\n but task is already holding lock:\n  (slab_mutex){+.+.+.}, at: [<ffffffff81176e15>] kmem_cache_destroy+0x45/0xe0\n\n which lock already depends on the new lock.\n\n the existing dependency chain (in reverse order) is:\n\n -> #2 (slab_mutex){+.+.+.}:\n        [<ffffffff810ae1e2>] validate_chain+0x632/0x720\n        [<ffffffff810ae5d9>] __lock_acquire+0x309/0x530\n        [<ffffffff810ae921>] lock_acquire+0x121/0x190\n        [<ffffffff8155d4cc>] __mutex_lock_common+0x5c/0x450\n        [<ffffffff8155d9ee>] mutex_lock_nested+0x3e/0x50\n        [<ffffffff81558cb5>] cpuup_callback+0x2f/0xbe\n        [<ffffffff81564b83>] notifier_call_chain+0x93/0x140\n        [<ffffffff81076f89>] __raw_notifier_call_chain+0x9/0x10\n        [<ffffffff8155719d>] _cpu_up+0xba/0x14e\n        [<ffffffff815572ed>] cpu_up+0xbc/0x117\n        [<ffffffff81ae05e3>] smp_init+0x6b/0x9f\n        [<ffffffff81ac47d6>] kernel_init+0x147/0x1dc\n        [<ffffffff8156ab44>] kernel_thread_helper+0x4/0x10\n\n -> #1 (cpu_hotplug.lock){+.+.+.}:\n        [<ffffffff810ae1e2>] validate_chain+0x632/0x720\n        [<ffffffff810ae5d9>] __lock_acquire+0x309/0x530\n        [<ffffffff810ae921>] lock_acquire+0x121/0x190\n        [<ffffffff8155d4cc>] __mutex_lock_common+0x5c/0x450\n        [<ffffffff8155d9ee>] mutex_lock_nested+0x3e/0x50\n        [<ffffffff81049197>] get_online_cpus+0x37/0x50\n        [<ffffffff810f21bb>] _rcu_barrier+0xbb/0x1e0\n        [<ffffffff810f22f0>] rcu_barrier_sched+0x10/0x20\n        [<ffffffff810f2309>] rcu_barrier+0x9/0x10\n        [<ffffffff8118c129>] deactivate_locked_super+0x49/0x90\n        [<ffffffff8118cc01>] deactivate_super+0x61/0x70\n        [<ffffffff811aaaa7>] mntput_no_expire+0x127/0x180\n        [<ffffffff811ab49e>] sys_umount+0x6e/0xd0\n        [<ffffffff81569979>] system_call_fastpath+0x16/0x1b\n\n -> #0 (rcu_sched_state.barrier_mutex){+.+...}:\n        [<ffffffff810adb4e>] check_prev_add+0x3de/0x440\n        [<ffffffff810ae1e2>] validate_chain+0x632/0x720\n        [<ffffffff810ae5d9>] __lock_acquire+0x309/0x530\n        [<ffffffff810ae921>] lock_acquire+0x121/0x190\n        [<ffffffff8155d4cc>] __mutex_lock_common+0x5c/0x450\n        [<ffffffff8155d9ee>] mutex_lock_nested+0x3e/0x50\n        [<ffffffff810f2126>] _rcu_barrier+0x26/0x1e0\n        [<ffffffff810f22f0>] rcu_barrier_sched+0x10/0x20\n        [<ffffffff810f2309>] rcu_barrier+0x9/0x10\n        [<ffffffff81176ea1>] kmem_cache_destroy+0xd1/0xe0\n        [<ffffffffa04c3154>] nf_conntrack_cleanup_net+0xe4/0x110 [nf_conntrack]\n        [<ffffffffa04c31aa>] nf_conntrack_cleanup+0x2a/0x70 [nf_conntrack]\n        [<ffffffffa04c42ce>] nf_conntrack_net_exit+0x5e/0x80 [nf_conntrack]\n        [<ffffffff81454b79>] ops_exit_list+0x39/0x60\n        [<ffffffff814551ab>] cleanup_net+0xfb/0x1b0\n        [<ffffffff8106917b>] process_one_work+0x26b/0x4c0\n        [<ffffffff81069f3e>] worker_thread+0x12e/0x320\n        [<ffffffff8106f73e>] kthread+0x9e/0xb0\n        [<ffffffff8156ab44>] kernel_thread_helper+0x4/0x10\n\n other info that might help us debug this:\n\n Chain exists of:\n   rcu_sched_state.barrier_mutex --> cpu_hotplug.lock --> slab_mutex\n\n  Possible unsafe locking scenario:\n\n        CPU0                    CPU1\n        ----                    ----\n   lock(slab_mutex);\n                                lock(cpu_hotplug.lock);\n                                lock(slab_mutex);\n   lock(rcu_sched_state.barrier_mutex);\n\n  *** DEADLOCK ***\n=== [ cut here ] ===\n\nThis is actually a false positive. Lockdep has no way of knowing the fact\nthat the ABBA can actually never happen, because of special semantics of\ncpu_hotplug.refcount and its handling in cpu_hotplug_begin(); the mutual\nexclusion there is not achieved through mutex, but through\ncpu_hotplug.refcount.\n\nThe \"neither cpu_up() nor cpu_down() will proceed past cpu_hotplug_begin()\nuntil everyone who called get_online_cpus() will call put_online_cpus()\"\nsemantics is totally invisible to lockdep.\n\nThis patch therefore moves the unlock of slab_mutex so that rcu_barrier()\nis being called with it unlocked. It has two advantages:\n\n- it slightly reduces hold time of slab_mutex; as it's used to protect\n  the cachep list, it's not necessary to hold it over kmem_cache_free()\n  call any more\n- it silences the lockdep false positive warning, as it avoids lockdep ever\n  learning about slab_mutex -> cpu_hotplug.lock dependency\n\nReviewed-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>\nReviewed-by: Srivatsa S. Bhat <srivatsa.bhat@linux.vnet.ibm.com>\nAcked-by: David Rientjes <rientjes@google.com>\nSigned-off-by...<truncated…","distinct":true,"url":"https://api.github.com/repos/TotallyAnxious/Dystopia_Kernel_M8/commits/5e67e313f93df5a5a82a93fe9ed29896dcb876aa"}]}