Avoid passing the kmem_cache_cpu pointer to node_match. This makes the
node_match function more generic and easier to understand.
Acked-by: David Rientjes <rientjes@google.com>
Signed-off-by: Christoph Lameter <cl@linux.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
* Check if the objects in a per cpu structure fit numa
* locality expectations.
*/
* Check if the objects in a per cpu structure fit numa
* locality expectations.
*/
-static inline int node_match(struct kmem_cache_cpu *c, int node)
+static inline int node_match(struct page *page, int node)
- if (node != NUMA_NO_NODE && page_to_nid(c->page) != node)
+ if (node != NUMA_NO_NODE && page_to_nid(page) != node)
return 0;
#endif
return 1;
return 0;
#endif
return 1;
- if (unlikely(!node_match(c, node))) {
+ if (unlikely(!node_match(page, node))) {
stat(s, ALLOC_NODE_MISMATCH);
deactivate_slab(s, page, c->freelist);
c->page = NULL;
stat(s, ALLOC_NODE_MISMATCH);
deactivate_slab(s, page, c->freelist);
c->page = NULL;
{
void **object;
struct kmem_cache_cpu *c;
{
void **object;
struct kmem_cache_cpu *c;
unsigned long tid;
if (slab_pre_alloc_hook(s, gfpflags))
unsigned long tid;
if (slab_pre_alloc_hook(s, gfpflags))
barrier();
object = c->freelist;
barrier();
object = c->freelist;
- if (unlikely(!object || !node_match(c, node)))
+ page = c->page;
+ if (unlikely(!object || !node_match(page, node)))
object = __slab_alloc(s, gfpflags, node, addr, c);
object = __slab_alloc(s, gfpflags, node, addr, c);