From: Christoph Lameter <cl@linux.com>
To: David Rientjes <rientjes@google.com>
Cc: Pekka Enberg <penberg@kernel.org>, linux-mm@kvack.org
Subject: Re: slub: [RFC] free slabs without holding locks.
Date: Thu, 14 Jul 2011 09:20:28 -0500 (CDT) [thread overview]
Message-ID: <alpine.DEB.2.00.1107140919050.30512@router.home> (raw)
In-Reply-To: <alpine.DEB.2.00.1107131710050.4557@chino.kir.corp.google.com>
On Wed, 13 Jul 2011, David Rientjes wrote:
> > > spin_unlock_irqrestore(&n->list_lock, flags);
> > > +
> > > + list_for_each_entry_safe(page, h, &empty, lru)
> > > + discard_slab(s, page);
> > > +
> > > + if (!list_empty(&n->partial))
> > > + list_for_each_entry(page, &n->partial, lru)
> > > + list_slab_objects(s, page,
> > > + "Objects remaining on kmem_cache_close()");
> > > }
> > >
> > > /*
>
> The last iteration to check for any pages remaining on the partial list is
> not safe because partial list manipulation is protected by list_lock.
> That needs to be fixed by testing for page->inuse during the iteration
> while still holding the lock and dropping the later iteration all
> together.
At this point no other process can be accessing the slab anymore. No need
for the list_lock
> > > @@ -2709,9 +2716,9 @@ void kmem_cache_destroy(struct kmem_cach
> > > }
> > > if (s->flags & SLAB_DESTROY_BY_RCU)
> > > rcu_barrier();
> > > - sysfs_slab_remove(s);
> > > - }
> > > - up_write(&slub_lock);
> > > + kfree(s);
>
> Why the new kfree() here? If the refcount is 0, then this should be
> handled when the sysfs entry is released regardless of whether
> sysfs_slab_remove() uses the CONFIG_SYSFS variant or not. If kfree(s)
> were needed here, we'd be leaking s->name as well.
Right. I will fix that.
--
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>
next prev parent reply other threads:[~2011-07-14 14:20 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-06-20 21:16 Christoph Lameter
2011-07-07 19:04 ` Pekka Enberg
2011-07-14 0:25 ` David Rientjes
2011-07-14 14:20 ` Christoph Lameter [this message]
2011-07-14 15:35 ` slub: free slabs without holding locks (V2) Christoph Lameter
2011-07-31 16:19 ` Pekka Enberg
2011-08-01 15:30 ` 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.DEB.2.00.1107140919050.30512@router.home \
--to=cl@linux.com \
--cc=linux-mm@kvack.org \
--cc=penberg@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