Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 373739
b: refs/heads/master
c: 7cccd80
h: refs/heads/master
i:
  373737: adcea39
  373735: 67e950c
v: v3
  • Loading branch information
Christoph Lameter authored and Pekka Enberg committed Apr 5, 2013
1 parent 4732996 commit 2e8b521
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 4d7868e6475d478172581828021bd8a356726679
refs/heads/master: 7cccd80b4397699902aced1ad3d692d384aaab77
12 changes: 9 additions & 3 deletions trunk/mm/slub.c
Original file line number Diff line number Diff line change
Expand Up @@ -2332,13 +2332,18 @@ static __always_inline void *slab_alloc_node(struct kmem_cache *s,

s = memcg_kmem_get_cache(s, gfpflags);
redo:

/*
* Must read kmem_cache cpu data via this cpu ptr. Preemption is
* enabled. We may switch back and forth between cpus while
* reading from one cpu area. That does not matter as long
* as we end up on the original cpu again when doing the cmpxchg.
*
* Preemption is disabled for the retrieval of the tid because that
* must occur from the current processor. We cannot allow rescheduling
* on a different processor between the determination of the pointer
* and the retrieval of the tid.
*/
preempt_disable();
c = __this_cpu_ptr(s->cpu_slab);

/*
Expand All @@ -2348,7 +2353,7 @@ static __always_inline void *slab_alloc_node(struct kmem_cache *s,
* linked list in between.
*/
tid = c->tid;
barrier();
preempt_enable();

object = c->freelist;
page = c->page;
Expand Down Expand Up @@ -2595,10 +2600,11 @@ static __always_inline void slab_free(struct kmem_cache *s,
* data is retrieved via this pointer. If we are on the same cpu
* during the cmpxchg then the free will succedd.
*/
preempt_disable();
c = __this_cpu_ptr(s->cpu_slab);

tid = c->tid;
barrier();
preempt_enable();

if (likely(page == c->page)) {
set_freepointer(s, object, c->freelist);
Expand Down

0 comments on commit 2e8b521

Please sign in to comment.