From: Dan Carpenter <dan.carpenter@oracle.com>
To: Matthew Wilcox <willy@infradead.org>
Cc: "Jérôme Glisse" <jglisse@redhat.com>,
linux-mm@kvack.org, kernel-janitors@vger.kernel.org,
"Andrew Morton" <akpm@linux-foundation.org>,
"Stephen Rothwell" <sfr@canb.auug.org.au>
Subject: Re: [PATCH] mm/hmm: potential deadlock in nonblocking code
Date: Mon, 4 Feb 2019 16:49:55 +0300 [thread overview]
Message-ID: <20190204134955.GE2581@kadam> (raw)
In-Reply-To: <20190204134203.GB21860@bombadil.infradead.org>
On Mon, Feb 04, 2019 at 05:42:03AM -0800, Matthew Wilcox wrote:
> On Mon, Feb 04, 2019 at 04:20:44PM +0300, Dan Carpenter wrote:
> >
> > - if (!nrange->blockable && !mutex_trylock(&hmm->lock)) {
> > - ret = -EAGAIN;
> > - goto out;
> > + if (!nrange->blockable) {
> > + if (!mutex_trylock(&hmm->lock)) {
> > + ret = -EAGAIN;
> > + goto out;
> > + }
> > } else
> > mutex_lock(&hmm->lock);
>
> I think this would be more readable written as:
>
> ret = -EAGAIN;
> if (nrange->blockable)
> mutex_lock(&hmm->lock);
> else if (!mutex_trylock(&hmm->lock))
> goto out;
I agree, that does look nicer. I will resend.
regards,
dan carpenter
next prev parent reply other threads:[~2019-02-04 13:50 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-02-04 13:20 [PATCH] mm/hmm: potential deadlock in nonblocking code Dan Carpenter
2019-02-04 13:42 ` Matthew Wilcox
2019-02-04 13:49 ` Dan Carpenter [this message]
2019-02-04 18:24 ` [PATCH v2] " Dan Carpenter
2019-02-11 19:11 ` Jerome Glisse
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=20190204134955.GE2581@kadam \
--to=dan.carpenter@oracle.com \
--cc=akpm@linux-foundation.org \
--cc=jglisse@redhat.com \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=sfr@canb.auug.org.au \
--cc=willy@infradead.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).