linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Dima Zavin <dmitriyz@waymo.com>
To: Christopher Lameter <cl@linux.com>
Cc: Mel Gorman <mgorman@suse.de>,
	Andrew Morton <akpm@linux-foundation.org>,
	Li Zefan <lizefan@huawei.com>, Pekka Enberg <penberg@kernel.org>,
	David Rientjes <rientjes@google.com>,
	Joonsoo Kim <iamjoonsoo.kim@lge.com>,
	cgroups@vger.kernel.org, LKML <linux-kernel@vger.kernel.org>,
	linux-mm@kvack.org, Cliff Spradlin <cspradlin@waymo.com>
Subject: Re: [RFC PATCH] mm/slub: fix a deadlock due to incomplete patching of cpusets_enabled()
Date: Wed, 26 Jul 2017 12:54:44 -0700	[thread overview]
Message-ID: <CAPz4a6DWohW+vjnvQLh2DNrVrn9CUQ3HNuZ+2fKZJkRc+hXq3w@mail.gmail.com> (raw)
In-Reply-To: <alpine.DEB.2.20.1707261158560.9311@nuc-kabylake>

On Wed, Jul 26, 2017 at 10:02 AM, Christopher Lameter <cl@linux.com> wrote:
> On Wed, 26 Jul 2017, Dima Zavin wrote:
>
>> The fix is to cache the value that's returned by cpusets_enabled() at the
>> top of the loop, and only operate on the seqlock (both begin and retry) if
>> it was true.
>
> I think the proper fix would be to ensure that the calls to
> read_mems_allowed_{begin,retry} cannot cause the deadlock. Otherwise you
> have to fix this in multiple places.
>
> Maybe read_mems_allowed_* can do some form of synchronization or *_retry
> can implictly rely on the results of cpusets_enabled() by *_begin?
>

(res-ending because gmail hates me, sorry).

Thanks for the quick reply!

I can turn the cookie into a uint64, put the sequence into the low
order 32 bits and put the enabled state into bit 33 (or 63 :) ). Then
retry will not query cpusets_enabled() and will just look at the
enabled bit. This means that *_retry will always have a conditional
jump (i.e. lose the whole static_branch optimization) but maybe that's
ok since that's pretty rare and the *_begin() will still benefit from
it?

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

  parent reply	other threads:[~2017-07-26 19:54 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-07-26 16:50 Dima Zavin
2017-07-26 17:02 ` Christopher Lameter
2017-07-26 19:52   ` Dima Zavin
2017-07-26 19:54   ` Dima Zavin [this message]
2017-07-27 16:46   ` [PATCH v2] cpuset: " Dima Zavin
2017-07-27 19:48     ` Andrew Morton
2017-07-27 21:41       ` Dima Zavin
2017-07-27 19:51     ` Andrew Morton
2017-07-27 21:41       ` Dima Zavin
2017-07-28  7:45     ` Vlastimil Babka
2017-07-28  8:48       ` Dima Zavin
2017-07-28  9:30       ` Peter Zijlstra
2017-07-28 14:05         ` Vlastimil Babka
2017-07-28 16:52           ` Dima Zavin
2017-07-31  4:01           ` [PATCH v3] " Dima Zavin
2017-07-31  4:04             ` Dima Zavin
2017-07-31  8:02             ` Vlastimil Babka
2017-07-31  9:05               ` Dima Zavin
2017-07-29  4:56     ` [PATCH v2] " kbuild test robot

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=CAPz4a6DWohW+vjnvQLh2DNrVrn9CUQ3HNuZ+2fKZJkRc+hXq3w@mail.gmail.com \
    --to=dmitriyz@waymo.com \
    --cc=akpm@linux-foundation.org \
    --cc=cgroups@vger.kernel.org \
    --cc=cl@linux.com \
    --cc=cspradlin@waymo.com \
    --cc=iamjoonsoo.kim@lge.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=lizefan@huawei.com \
    --cc=mgorman@suse.de \
    --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