linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] SLAB: Record actual last user of freed objects.
@ 2011-06-02  7:16 Suleiman Souhlal
  2011-06-02 17:12 ` David Rientjes
  0 siblings, 1 reply; 4+ messages in thread
From: Suleiman Souhlal @ 2011-06-02  7:16 UTC (permalink / raw)
  To: penberg; +Cc: suleiman, linux-kernel, linux-mm, cl, mpm, Suleiman Souhlal

Currently, when using CONFIG_DEBUG_SLAB, we put in kfree() or
kmem_cache_free() as the last user of free objects, which is not
very useful, so change it to the caller of those functions instead.

Signed-off-by: Suleiman Souhlal <suleiman@google.com>
---
 mm/slab.c |    9 +++++----
 1 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/mm/slab.c b/mm/slab.c
index 98f114d..615e76c 100644
--- a/mm/slab.c
+++ b/mm/slab.c
@@ -3603,13 +3603,14 @@ free_done:
  * Release an obj back to its cache. If the obj has a constructed state, it must
  * be in this state _before_ it is released.  Called with disabled ints.
  */
-static inline void __cache_free(struct kmem_cache *cachep, void *objp)
+static inline void __cache_free(struct kmem_cache *cachep, void *objp,
+    void *caller)
 {
 	struct array_cache *ac = cpu_cache_get(cachep);
 
 	check_irq_off();
 	kmemleak_free_recursive(objp, cachep->flags);
-	objp = cache_free_debugcheck(cachep, objp, __builtin_return_address(0));
+	objp = cache_free_debugcheck(cachep, objp, caller);
 
 	kmemcheck_slab_free(cachep, objp, obj_size(cachep));
 
@@ -3800,7 +3801,7 @@ void kmem_cache_free(struct kmem_cache *cachep, void *objp)
 	debug_check_no_locks_freed(objp, obj_size(cachep));
 	if (!(cachep->flags & SLAB_DEBUG_OBJECTS))
 		debug_check_no_obj_freed(objp, obj_size(cachep));
-	__cache_free(cachep, objp);
+	__cache_free(cachep, objp, __builtin_return_address(0));
 	local_irq_restore(flags);
 
 	trace_kmem_cache_free(_RET_IP_, objp);
@@ -3830,7 +3831,7 @@ void kfree(const void *objp)
 	c = virt_to_cache(objp);
 	debug_check_no_locks_freed(objp, obj_size(c));
 	debug_check_no_obj_freed(objp, obj_size(c));
-	__cache_free(c, (void *)objp);
+	__cache_free(c, (void *)objp, __builtin_return_address(0));
 	local_irq_restore(flags);
 }
 EXPORT_SYMBOL(kfree);
-- 
1.7.3.1

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] SLAB: Record actual last user of freed objects.
  2011-06-02  7:16 [PATCH] SLAB: Record actual last user of freed objects Suleiman Souhlal
@ 2011-06-02 17:12 ` David Rientjes
  2011-06-03 14:05   ` Christoph Lameter
  0 siblings, 1 reply; 4+ messages in thread
From: David Rientjes @ 2011-06-02 17:12 UTC (permalink / raw)
  To: Suleiman Souhlal; +Cc: penberg, suleiman, linux-kernel, linux-mm, cl, mpm

On Thu, 2 Jun 2011, Suleiman Souhlal wrote:

> Currently, when using CONFIG_DEBUG_SLAB, we put in kfree() or
> kmem_cache_free() as the last user of free objects, which is not
> very useful, so change it to the caller of those functions instead.
> 
> Signed-off-by: Suleiman Souhlal <suleiman@google.com>

Acked-by: David Rientjes <rientjes@google.com>

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] SLAB: Record actual last user of freed objects.
  2011-06-02 17:12 ` David Rientjes
@ 2011-06-03 14:05   ` Christoph Lameter
  2011-06-03 18:07     ` Pekka Enberg
  0 siblings, 1 reply; 4+ messages in thread
From: Christoph Lameter @ 2011-06-03 14:05 UTC (permalink / raw)
  To: David Rientjes
  Cc: Suleiman Souhlal, penberg, suleiman, linux-kernel, linux-mm, mpm

On Thu, 2 Jun 2011, David Rientjes wrote:

> On Thu, 2 Jun 2011, Suleiman Souhlal wrote:
>
> > Currently, when using CONFIG_DEBUG_SLAB, we put in kfree() or
> > kmem_cache_free() as the last user of free objects, which is not
> > very useful, so change it to the caller of those functions instead.
> >
> > Signed-off-by: Suleiman Souhlal <suleiman@google.com>
>
> Acked-by: David Rientjes <rientjes@google.com>

Well note that this increases the overhead of a hot code path. But slub
does the same

Acked-by: Christoph Lameter <cl@linux.com>

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] SLAB: Record actual last user of freed objects.
  2011-06-03 14:05   ` Christoph Lameter
@ 2011-06-03 18:07     ` Pekka Enberg
  0 siblings, 0 replies; 4+ messages in thread
From: Pekka Enberg @ 2011-06-03 18:07 UTC (permalink / raw)
  To: Christoph Lameter
  Cc: David Rientjes, Suleiman Souhlal, suleiman, linux-kernel,
	linux-mm, mpm

On Fri, Jun 3, 2011 at 5:05 PM, Christoph Lameter <cl@linux.com> wrote:
> On Thu, 2 Jun 2011, David Rientjes wrote:
>
>> On Thu, 2 Jun 2011, Suleiman Souhlal wrote:
>>
>> > Currently, when using CONFIG_DEBUG_SLAB, we put in kfree() or
>> > kmem_cache_free() as the last user of free objects, which is not
>> > very useful, so change it to the caller of those functions instead.
>> >
>> > Signed-off-by: Suleiman Souhlal <suleiman@google.com>
>>
>> Acked-by: David Rientjes <rientjes@google.com>
>
> Well note that this increases the overhead of a hot code path. But slub
> does the same
>
> Acked-by: Christoph Lameter <cl@linux.com>

Applied, thanks!

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2011-06-03 18:07 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-06-02  7:16 [PATCH] SLAB: Record actual last user of freed objects Suleiman Souhlal
2011-06-02 17:12 ` David Rientjes
2011-06-03 14:05   ` Christoph Lameter
2011-06-03 18:07     ` Pekka Enberg

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).