linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Vladimir Davydov <vdavydov@parallels.com>
To: Tejun Heo <tj@kernel.org>
Cc: Dan Carpenter <dan.carpenter@oracle.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	David Rientjes <rientjes@google.com>,
	Christoph Lameter <cl@linux.com>, Zefan Li <lizefan@huawei.com>,
	Pekka Enberg <penberg@kernel.org>,
	Joonsoo Kim <iamjoonsoo.kim@lge.com>,
	linux-kernel@vger.kernel.org, linux-mm@kvack.org
Subject: Re: [PATCH RESEND 2/4] cpuset: simplify cpuset_node_allowed API
Date: Mon, 27 Oct 2014 18:36:54 +0300	[thread overview]
Message-ID: <20141027153654.GF17258@esperanza> (raw)
In-Reply-To: <20141027151806.GR4436@htj.dyndns.org>

Hi Tejun,

On Mon, Oct 27, 2014 at 11:18:06AM -0400, Tejun Heo wrote:
> On Mon, Oct 20, 2014 at 03:50:30PM +0400, Vladimir Davydov wrote:
> > Current cpuset API for checking if a zone/node is allowed to allocate
> > from looks rather awkward. We have hardwall and softwall versions of
> > cpuset_node_allowed with the softwall version doing literally the same
> > as the hardwall version if __GFP_HARDWALL is passed to it in gfp flags.
> > If it isn't, the softwall version may check the given node against the
> > enclosing hardwall cpuset, which it needs to take the callback lock to
> > do.
> > 
> > Such a distinction was introduced by commit 02a0e53d8227 ("cpuset:
> > rework cpuset_zone_allowed api"). Before, we had the only version with
> > the __GFP_HARDWALL flag determining its behavior. The purpose of the
> > commit was to avoid sleep-in-atomic bugs when someone would mistakenly
> > call the function without the __GFP_HARDWALL flag for an atomic
> > allocation. The suffixes introduced were intended to make the callers
> > think before using the function.
> > 
> > However, since the callback lock was converted from mutex to spinlock by
> > the previous patch, the softwall check function cannot sleep, and these
> > precautions are no longer necessary.
> > 
> > So let's simplify the API back to the single check.
> > 
> > Suggested-by: David Rientjes <rientjes@google.com>
> > Signed-off-by: Vladimir Davydov <vdavydov@parallels.com>
> > Acked-by: Christoph Lameter <cl@linux.com>
> > Acked-by: Zefan Li <lizefan@huawei.com>
> 
> Applied 1-2 to cgroup/for-3.19-cpuset-api-simplification which
> contains only these two patches on top of v3.18-rc2 and will stay
> stable.  sl[au]b trees can pull it in or I can take the other two
> patches too.  Please let me know how the other two should be routed.

JFYI, Andrew merged all four patches in his mmotm tree.

FWIW, there's a typo in this patch recently found and fixed by Dan
Carpenter. The fix is below.

Thanks,
Vladimir

---
From: Dan Carpenter <dan.carpenter@oracle.com>

This will deadlock instead of unlocking.

Fixes: f73eae8d8384 ('cpuset: simplify cpuset_node_allowed API')
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Acked-by: Vladimir Davydov <vdavydov@parallels.com>

diff --git a/kernel/cpuset.c b/kernel/cpuset.c
index 38f7433..4eaa203 100644
--- a/kernel/cpuset.c
+++ b/kernel/cpuset.c
@@ -1992,7 +1992,7 @@ static int cpuset_css_online(struct cgroup_subsys_state *css)
 	spin_lock_irq(&callback_lock);
 	cs->mems_allowed = parent->mems_allowed;
 	cpumask_copy(cs->cpus_allowed, parent->cpus_allowed);
-	spin_lock_irq(&callback_lock);
+	spin_unlock_irq(&callback_lock);
 out_unlock:
 	mutex_unlock(&cpuset_mutex);
 	return 0;

--
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>

  reply	other threads:[~2014-10-27 15:37 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-10-20 11:50 [PATCH RESEND 0/4] Simplify cpuset API and fix cpuset check in SL[AU]B Vladimir Davydov
2014-10-20 11:50 ` [PATCH RESEND 1/4] cpuset: convert callback_mutex to a spinlock Vladimir Davydov
2014-10-20 11:50 ` [PATCH RESEND 2/4] cpuset: simplify cpuset_node_allowed API Vladimir Davydov
2014-10-27 15:18   ` Tejun Heo
2014-10-27 15:36     ` Vladimir Davydov [this message]
2014-10-27 15:56       ` Tejun Heo
2014-10-20 11:50 ` [PATCH RESEND 3/4] slab: fix cpuset check in fallback_alloc Vladimir Davydov
2014-10-20 11:50 ` [PATCH RESEND 4/4] slub: fix cpuset check in get_any_partial Vladimir Davydov

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=20141027153654.GF17258@esperanza \
    --to=vdavydov@parallels.com \
    --cc=akpm@linux-foundation.org \
    --cc=cl@linux.com \
    --cc=dan.carpenter@oracle.com \
    --cc=iamjoonsoo.kim@lge.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=lizefan@huawei.com \
    --cc=penberg@kernel.org \
    --cc=rientjes@google.com \
    --cc=tj@kernel.org \
    /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;
as well as URLs for NNTP newsgroup(s).