diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2008-07-15 14:26:14 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2008-07-15 14:26:14 -0400 |
commit | b9d2252c1e44fa83a4e65fdc9eb93db6297c55af (patch) | |
tree | 7db5a11d1d57a56fc330b8313680bbbe4eb3a564 | |
parent | b312bf359e20cc39c00d480fd40a24c245d80bf7 (diff) | |
parent | e79aec291da55aa322ddb5d8f3bb04cdf69470d5 (diff) |
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/penberg/slab-2.6
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/penberg/slab-2.6:
slab: rename slab_destroy_objs
slub: current is always valid
slub: Add check for kfree() of non slab objects.
-rw-r--r-- | mm/slab.c | 14 | ||||
-rw-r--r-- | mm/slub.c | 3 |
2 files changed, 5 insertions, 12 deletions
@@ -1901,15 +1901,7 @@ static void check_poison_obj(struct kmem_cache *cachep, void *objp) | |||
1901 | #endif | 1901 | #endif |
1902 | 1902 | ||
1903 | #if DEBUG | 1903 | #if DEBUG |
1904 | /** | 1904 | static void slab_destroy_debugcheck(struct kmem_cache *cachep, struct slab *slabp) |
1905 | * slab_destroy_objs - destroy a slab and its objects | ||
1906 | * @cachep: cache pointer being destroyed | ||
1907 | * @slabp: slab pointer being destroyed | ||
1908 | * | ||
1909 | * Call the registered destructor for each object in a slab that is being | ||
1910 | * destroyed. | ||
1911 | */ | ||
1912 | static void slab_destroy_objs(struct kmem_cache *cachep, struct slab *slabp) | ||
1913 | { | 1905 | { |
1914 | int i; | 1906 | int i; |
1915 | for (i = 0; i < cachep->num; i++) { | 1907 | for (i = 0; i < cachep->num; i++) { |
@@ -1938,7 +1930,7 @@ static void slab_destroy_objs(struct kmem_cache *cachep, struct slab *slabp) | |||
1938 | } | 1930 | } |
1939 | } | 1931 | } |
1940 | #else | 1932 | #else |
1941 | static void slab_destroy_objs(struct kmem_cache *cachep, struct slab *slabp) | 1933 | static void slab_destroy_debugcheck(struct kmem_cache *cachep, struct slab *slabp) |
1942 | { | 1934 | { |
1943 | } | 1935 | } |
1944 | #endif | 1936 | #endif |
@@ -1956,7 +1948,7 @@ static void slab_destroy(struct kmem_cache *cachep, struct slab *slabp) | |||
1956 | { | 1948 | { |
1957 | void *addr = slabp->s_mem - slabp->colouroff; | 1949 | void *addr = slabp->s_mem - slabp->colouroff; |
1958 | 1950 | ||
1959 | slab_destroy_objs(cachep, slabp); | 1951 | slab_destroy_debugcheck(cachep, slabp); |
1960 | if (unlikely(cachep->flags & SLAB_DESTROY_BY_RCU)) { | 1952 | if (unlikely(cachep->flags & SLAB_DESTROY_BY_RCU)) { |
1961 | struct slab_rcu *slab_rcu; | 1953 | struct slab_rcu *slab_rcu; |
1962 | 1954 | ||
@@ -411,7 +411,7 @@ static void set_track(struct kmem_cache *s, void *object, | |||
411 | if (addr) { | 411 | if (addr) { |
412 | p->addr = addr; | 412 | p->addr = addr; |
413 | p->cpu = smp_processor_id(); | 413 | p->cpu = smp_processor_id(); |
414 | p->pid = current ? current->pid : -1; | 414 | p->pid = current->pid; |
415 | p->when = jiffies; | 415 | p->when = jiffies; |
416 | } else | 416 | } else |
417 | memset(p, 0, sizeof(struct track)); | 417 | memset(p, 0, sizeof(struct track)); |
@@ -2766,6 +2766,7 @@ void kfree(const void *x) | |||
2766 | 2766 | ||
2767 | page = virt_to_head_page(x); | 2767 | page = virt_to_head_page(x); |
2768 | if (unlikely(!PageSlab(page))) { | 2768 | if (unlikely(!PageSlab(page))) { |
2769 | BUG_ON(!PageCompound(page)); | ||
2769 | put_page(page); | 2770 | put_page(page); |
2770 | return; | 2771 | return; |
2771 | } | 2772 | } |