public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Ingo Molnar <mingo@elte.hu>
To: Paul Menage <menage@google.com>
Cc: Lai Jiangshan <laijs@cn.fujitsu.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	miaox@cn.fujitsu.com, maxk@qualcomm.com,
	linux-kernel@vger.kernel.org,
	Peter Zijlstra <a.p.zijlstra@chello.nl>
Subject: Re: [PATCH 1/3] cgroup: convert open-coded mutex_lock(&cgroup_mutex) calls into cgroup_lock() calls
Date: Mon, 19 Jan 2009 02:41:43 +0100	[thread overview]
Message-ID: <20090119014143.GA10271@elte.hu> (raw)
In-Reply-To: <6599ad830901181737m1d04bb85t7bb0b48e925733a6@mail.gmail.com>


* Paul Menage <menage@google.com> wrote:

> On Sun, Jan 18, 2009 at 1:10 AM, Ingo Molnar <mingo@elte.hu> wrote:
> > this just changes over a clean mutex call to a wrapped lock/unlock
> > sequence that has higher overhead in the common case.
> >
> > We should do the exact opposite, we should change this opaque API:
> >
> >  void cgroup_lock(void)
> >  {
> >         mutex_lock(&cgroup_mutex);
> >  }
> >
> > To something more explicit (and more maintainable) like:
> 
> I disagree - cgroup_mutex is a very coarse lock that can be held for 
> pretty long periods of time by the cgroups framework, and should never 
> be part of any fastpath code. So the overhead of a function call should 
> be irrelevant.
> 
> The change that you're proposing would send the message that 
> cgroup_mutex_lock(&cgroup_mutex) is appropriate to use in a 
> performance-sensitive function, when in fact we want to discourage such 
> code from taking this lock and instead use more appropriately 
> fine-grained locks.

Uhm, how does that 'discourage' its use in fastpath code?

It just hides the real lock and invites bad locking/work constructs like 
the one proposed in this thread.

	Ingo

  reply	other threads:[~2009-01-19  1:42 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-01-16  2:24 [PATCH] cpuset: fix possible deadlock in async_rebuild_sched_domains Miao Xie
2009-01-16  3:33 ` Lai Jiangshan
2009-01-16 20:57   ` Andrew Morton
2009-01-18  8:06     ` [PATCH 1/3] cgroup: convert open-coded mutex_lock(&cgroup_mutex) calls into cgroup_lock() calls Lai Jiangshan
2009-01-18  9:10       ` Ingo Molnar
2009-01-19  1:37         ` Paul Menage
2009-01-19  1:41           ` Ingo Molnar [this message]
2009-01-20  1:28             ` Paul Menage
2009-01-20 18:22               ` Peter Zijlstra
2009-01-20  1:18       ` Paul Menage
2009-01-18  8:06     ` [PATCH 2/3] cgroup: introduce cgroup_queue_deferred_work() Lai Jiangshan
2009-01-18  9:04       ` Ingo Molnar
2009-01-19  1:55         ` Lai Jiangshan
2009-01-20  1:26       ` Paul Menage
2009-01-18  8:06     ` [PATCH 3/3] cpuset: fix possible deadlock in async_rebuild_sched_domains Lai Jiangshan
2009-01-18  9:06       ` Ingo Molnar
2009-01-19  1:40         ` Lai Jiangshan

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=20090119014143.GA10271@elte.hu \
    --to=mingo@elte.hu \
    --cc=a.p.zijlstra@chello.nl \
    --cc=akpm@linux-foundation.org \
    --cc=laijs@cn.fujitsu.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=maxk@qualcomm.com \
    --cc=menage@google.com \
    --cc=miaox@cn.fujitsu.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