mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Pekka Enberg <penberg@kernel.org>
To: Christoph Lameter <cl@linux.com>
Cc: David Rientjes <rientjes@google.com>,
	Eric Dumazet <eric.dumazet@gmail.com>,
	linux-kernel@vger.kernel.org
Subject: Re: slub: Lockout validation scans during freeing of object
Date: Mon, 12 Dec 2011 09:17:47 +0200 (EET)	[thread overview]
Message-ID: <alpine.LFD.2.02.1112120917230.2555@tux.localdomain> (raw)
In-Reply-To: <alpine.DEB.2.00.1111230922210.16544@router.home>

On Wed, 23 Nov 2011, Christoph Lameter wrote:

> Eric tested this one.
>
>
> Subject: slub: Lockout validation scans during freeing of object
>
> Slab validation can run right now while the slab free paths prepare
> the redzone fields etc around the objects in preparation of the
> actual freeing of the object. This can lead to false positives.
>
> Take the node lock unconditionally during free so that the validation
> can examine objects without them being disturbed by freeing operations.
>
> Signed-off-by: Christoph Lameter <cl@linux.com>
>
> ---
> mm/slub.c |   12 ++++++++++--
> 1 file changed, 10 insertions(+), 2 deletions(-)
>
> Index: linux-2.6/mm/slub.c
> ===================================================================
> --- linux-2.6.orig/mm/slub.c	2011-11-22 10:42:19.000000000 -0600
> +++ linux-2.6/mm/slub.c	2011-11-22 10:44:34.000000000 -0600
> @@ -2391,8 +2391,15 @@ static void __slab_free(struct kmem_cach
>
> 	stat(s, FREE_SLOWPATH);
>
> -	if (kmem_cache_debug(s) && !free_debug_processing(s, page, x, addr))
> -		return;
> +	if (kmem_cache_debug(s)) {
> +
> +		/* Lock out any concurrent validate_slab calls */
> +		n = get_node(s, page_to_nid(page));
> +		spin_lock_irqsave(&n->list_lock, flags);
> +
> +		if (!free_debug_processing(s, page, x, addr))
> +			goto out;
> +	}
>
> 	do {
> 		prior = page->freelist;
> @@ -2471,6 +2478,7 @@ static void __slab_free(struct kmem_cach
> 			stat(s, FREE_ADD_PARTIAL);
> 		}
> 	}
> +out:
> 	spin_unlock_irqrestore(&n->list_lock, flags);
> 	return;

Ditto.

       reply	other threads:[~2011-12-12  7:18 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <alpine.DEB.2.00.1111230922210.16544@router.home>
2011-12-12  7:17 ` Pekka Enberg [this message]
2011-12-15  3:14   ` David Rientjes
2011-11-22 16:36 WARNING: at mm/slub.c:3357, kernel BUG at mm/slub.c:3413 Christoph Lameter
2011-11-22 16:41 ` Christoph Lameter
2011-11-22 16:53   ` slub: Lockout validation scans during freeing of object Christoph Lameter
2011-11-22 17:21     ` Eric Dumazet
2011-11-22 17:40       ` Christoph Lameter
2011-11-22 18:55         ` Markus Trippelsdorf
2011-11-22 19:20           ` Christoph Lameter
2011-11-22 19:32             ` Markus Trippelsdorf
2011-11-22 19:46               ` Christoph Lameter
2011-11-22 17:59       ` Christoph Lameter

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=alpine.LFD.2.02.1112120917230.2555@tux.localdomain \
    --to=penberg@kernel.org \
    --cc=cl@linux.com \
    --cc=eric.dumazet@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rientjes@google.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®