All of lore.kernel.org
 help / color / mirror / Atom feed
From: Vladimir Davydov <vdavydov@parallels.com>
To: Christoph Lameter <cl@gentwo.org>
Cc: hannes@cmpxchg.org, mhocko@suse.cz, akpm@linux-foundation.org,
	linux-kernel@vger.kernel.org, linux-mm@kvack.org
Subject: Re: [PATCH RFC 3/3] slub: reparent memcg caches' slabs on memcg offline
Date: Fri, 23 May 2014 23:57:30 +0400	[thread overview]
Message-ID: <20140523195728.GA21344@esperanza> (raw)
In-Reply-To: <alpine.DEB.2.10.1405231241250.22913@gentwo.org>

On Fri, May 23, 2014 at 12:45:48PM -0500, Christoph Lameter wrote:
> On Fri, 23 May 2014, Vladimir Davydov wrote:
> 
> > On Thu, May 22, 2014 at 02:25:30PM -0500, Christoph Lameter wrote:
> > > slab_free calls __slab_free which can release slabs via
> > > put_cpu_partial()/unfreeze_partials()/discard_slab() to the page
> > > allocator. I'd rather have preemption enabled there.
> >
> > Hmm, why? IMO, calling __free_pages with preempt disabled won't hurt
> > latency, because it proceeds really fast. BTW, we already call it for a
> > bunch of pages from __slab_free() -> put_cpu_partial() ->
> > unfreeze_partials() with irqs disabled, which is harder. FWIW, SLAB has
> > the whole obj free path executed under local_irq_save/restore, and it
> > doesn't bother enabling irqs for freeing pages.
> >
> > IMO, the latency improvement we can achieve by enabling preemption while
> > calling __free_pages is rather minor, and it isn't worth complicating
> > the code.
> 
> If you look at the end of unfreeze_partials() you see that we release
> locks and therefore enable preempt before calling into the page allocator.

Yes, we release the node's list_lock before calling discard_slab(), but
we don't enable irqs, which are disabled in put_cpu_partial(), just
before calling it, so we call the page allocator with irqs off and
therefore preemption disabled.

> You never know what other new features they are going to be adding to the
> page allocator. I'd rather be safe than sorry on this one. We have had
> some trouble in the past with some debugging logic triggering.

I guess by "some troubles in the past with some debugging logic
triggering" you mean the issue that was fixed by commit 9ada19342b244 ?

    From: Shaohua Li <shaohua.li@intel.com>

    slub: move discard_slab out of node lock
    
    Lockdep reports there is potential deadlock for slub node list_lock.
    discard_slab() is called with the lock hold in unfreeze_partials(),
    which could trigger a slab allocation, which could hold the lock again.
    
    discard_slab() doesn't need hold the lock actually, if the slab is
    already removed from partial list.

If so - nothing to worry about, because I'm not going to make calls to
the page allocator under an internal slab lock. What I propose is
calling __free_pages with preempt disabled, which already happens here
and there and can't result in deadlocks or lockdep warns.

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/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

WARNING: multiple messages have this Message-ID (diff)
From: Vladimir Davydov <vdavydov@parallels.com>
To: Christoph Lameter <cl@gentwo.org>
Cc: <hannes@cmpxchg.org>, <mhocko@suse.cz>,
	<akpm@linux-foundation.org>, <linux-kernel@vger.kernel.org>,
	<linux-mm@kvack.org>
Subject: Re: [PATCH RFC 3/3] slub: reparent memcg caches' slabs on memcg offline
Date: Fri, 23 May 2014 23:57:30 +0400	[thread overview]
Message-ID: <20140523195728.GA21344@esperanza> (raw)
In-Reply-To: <alpine.DEB.2.10.1405231241250.22913@gentwo.org>

On Fri, May 23, 2014 at 12:45:48PM -0500, Christoph Lameter wrote:
> On Fri, 23 May 2014, Vladimir Davydov wrote:
> 
> > On Thu, May 22, 2014 at 02:25:30PM -0500, Christoph Lameter wrote:
> > > slab_free calls __slab_free which can release slabs via
> > > put_cpu_partial()/unfreeze_partials()/discard_slab() to the page
> > > allocator. I'd rather have preemption enabled there.
> >
> > Hmm, why? IMO, calling __free_pages with preempt disabled won't hurt
> > latency, because it proceeds really fast. BTW, we already call it for a
> > bunch of pages from __slab_free() -> put_cpu_partial() ->
> > unfreeze_partials() with irqs disabled, which is harder. FWIW, SLAB has
> > the whole obj free path executed under local_irq_save/restore, and it
> > doesn't bother enabling irqs for freeing pages.
> >
> > IMO, the latency improvement we can achieve by enabling preemption while
> > calling __free_pages is rather minor, and it isn't worth complicating
> > the code.
> 
> If you look at the end of unfreeze_partials() you see that we release
> locks and therefore enable preempt before calling into the page allocator.

Yes, we release the node's list_lock before calling discard_slab(), but
we don't enable irqs, which are disabled in put_cpu_partial(), just
before calling it, so we call the page allocator with irqs off and
therefore preemption disabled.

> You never know what other new features they are going to be adding to the
> page allocator. I'd rather be safe than sorry on this one. We have had
> some trouble in the past with some debugging logic triggering.

I guess by "some troubles in the past with some debugging logic
triggering" you mean the issue that was fixed by commit 9ada19342b244 ?

    From: Shaohua Li <shaohua.li@intel.com>

    slub: move discard_slab out of node lock
    
    Lockdep reports there is potential deadlock for slub node list_lock.
    discard_slab() is called with the lock hold in unfreeze_partials(),
    which could trigger a slab allocation, which could hold the lock again.
    
    discard_slab() doesn't need hold the lock actually, if the slab is
    already removed from partial list.

If so - nothing to worry about, because I'm not going to make calls to
the page allocator under an internal slab lock. What I propose is
calling __free_pages with preempt disabled, which already happens here
and there and can't result in deadlocks or lockdep warns.

Thanks.

  reply	other threads:[~2014-05-23 19:57 UTC|newest]

Thread overview: 62+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-05-13 13:48 [PATCH RFC 0/3] kmemcg slab reparenting Vladimir Davydov
2014-05-13 13:48 ` Vladimir Davydov
2014-05-13 13:48 ` [PATCH RFC 1/3] slub: keep full slabs on list for per memcg caches Vladimir Davydov
2014-05-13 13:48   ` Vladimir Davydov
2014-05-14 16:16   ` Christoph Lameter
2014-05-14 16:16     ` Christoph Lameter
2014-05-15  6:34     ` Vladimir Davydov
2014-05-15  6:34       ` Vladimir Davydov
2014-05-15 15:15       ` Christoph Lameter
2014-05-15 15:15         ` Christoph Lameter
2014-05-16 13:06         ` Vladimir Davydov
2014-05-16 13:06           ` Vladimir Davydov
2014-05-16 15:05           ` Christoph Lameter
2014-05-16 15:05             ` Christoph Lameter
2014-05-13 13:48 ` [PATCH RFC 2/3] percpu-refcount: allow to get dead reference Vladimir Davydov
2014-05-13 13:48   ` Vladimir Davydov
2014-05-13 13:48 ` [PATCH RFC 3/3] slub: reparent memcg caches' slabs on memcg offline Vladimir Davydov
2014-05-13 13:48   ` Vladimir Davydov
2014-05-14 16:20   ` Christoph Lameter
2014-05-14 16:20     ` Christoph Lameter
2014-05-15  7:16     ` Vladimir Davydov
2014-05-15  7:16       ` Vladimir Davydov
2014-05-15 15:16       ` Christoph Lameter
2014-05-15 15:16         ` Christoph Lameter
2014-05-16 13:22         ` Vladimir Davydov
2014-05-16 13:22           ` Vladimir Davydov
2014-05-16 15:03           ` Christoph Lameter
2014-05-16 15:03             ` Christoph Lameter
2014-05-19 15:24             ` Vladimir Davydov
2014-05-19 15:24               ` Vladimir Davydov
2014-05-19 16:03               ` Christoph Lameter
2014-05-19 16:03                 ` Christoph Lameter
2014-05-19 18:27                 ` Vladimir Davydov
2014-05-19 18:27                   ` Vladimir Davydov
2014-05-21 13:58                   ` Vladimir Davydov
2014-05-21 13:58                     ` Vladimir Davydov
2014-05-21 14:45                     ` Christoph Lameter
2014-05-21 14:45                       ` Christoph Lameter
2014-05-21 15:14                       ` Vladimir Davydov
2014-05-21 15:14                         ` Vladimir Davydov
2014-05-22  0:15                         ` Christoph Lameter
2014-05-22  0:15                           ` Christoph Lameter
2014-05-22 14:07                           ` Vladimir Davydov
2014-05-22 14:07                             ` Vladimir Davydov
2014-05-21 14:41                   ` Christoph Lameter
2014-05-21 14:41                     ` Christoph Lameter
2014-05-21 15:04                     ` Vladimir Davydov
2014-05-21 15:04                       ` Vladimir Davydov
2014-05-22  0:13                       ` Christoph Lameter
2014-05-22  0:13                         ` Christoph Lameter
2014-05-22 13:47                         ` Vladimir Davydov
2014-05-22 13:47                           ` Vladimir Davydov
2014-05-22 19:25                           ` Christoph Lameter
2014-05-22 19:25                             ` Christoph Lameter
2014-05-23 15:26                             ` Vladimir Davydov
2014-05-23 15:26                               ` Vladimir Davydov
2014-05-23 17:45                               ` Christoph Lameter
2014-05-23 17:45                                 ` Christoph Lameter
2014-05-23 19:57                                 ` Vladimir Davydov [this message]
2014-05-23 19:57                                   ` Vladimir Davydov
2014-05-27 14:38                                   ` Christoph Lameter
2014-05-27 14:38                                     ` 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=20140523195728.GA21344@esperanza \
    --to=vdavydov@parallels.com \
    --cc=akpm@linux-foundation.org \
    --cc=cl@gentwo.org \
    --cc=hannes@cmpxchg.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mhocko@suse.cz \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.