From: vitalywool@gmail.com
To: Alexey Khoroshilov <khoroshilov@ispras.ru>
Cc: Matthew Wilcox <willy@infradead.org>,
Andrew Morton <akpm@linux-foundation.org>,
Dan Streetman <ddstreet@ieee.org>,
linux-mm@kvack.org, linux-kernel@vger.kernel.org,
ldv-project@linuxtesting.org
Subject: Re: z3fold: suspicious return with spinlock held
Date: Fri, 10 Mar 2017 23:08:53 +0100 [thread overview]
Message-ID: <2E74B250-1EE0-483A-ACA0-143C4F1ECD44@gmail.com> (raw)
In-Reply-To: <82e268d4-22fa-3e33-8988-a3a367fae7b1@ispras.ru>
Hi Alexey,
> 10 mars 2017 kl. 22:54 skrev Alexey Khoroshilov <khoroshilov@ispras.ru>:
>
>> On 11.03.2017 00:34, Matthew Wilcox wrote:
>>> On Sat, Mar 11, 2017 at 12:22:12AM +0300, Alexey Khoroshilov wrote:
>>> Hello!
>>>
>>> z3fold_reclaim_page() contains the only return that may
>>> leave the function with pool->lock spinlock held.
>>>
>>> 669 spin_lock(&pool->lock);
>>> 670 if (kref_put(&zhdr->refcount, release_z3fold_page)) {
>>> 671 atomic64_dec(&pool->pages_nr);
>>> 672 return 0;
>>> 673 }
>>>
>>> May be we need spin_unlock(&pool->lock); just before return?
Looks so, thanks for the pointer. I'm currently commuting but will check it thoroughly tomorrow for sure.
~vitaly
>>
>> I would tend to agree. sparse warns about this, and also about two
>> other locking problems ... which I'm not sure are really problems so
>> much as missing annotations?
>>
>> mm/z3fold.c:467:35: warning: context imbalance in 'z3fold_alloc' - unexpected unlock
>> mm/z3fold.c:519:26: warning: context imbalance in 'z3fold_free' - different lock contexts for basic block
>> mm/z3fold.c:581:12: warning: context imbalance in 'z3fold_reclaim_page' - different lock contexts for basic block
>>
>
> I also do not see problems in z3fold_alloc() and z3fold_free().
> But I am unaware of sparse annotations that can help here.
>
> --
> Alexey
--
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>
prev parent reply other threads:[~2017-03-10 22:08 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-03-10 21:22 Alexey Khoroshilov
2017-03-10 21:34 ` Matthew Wilcox
2017-03-10 21:54 ` Alexey Khoroshilov
2017-03-10 22:08 ` vitalywool [this message]
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=2E74B250-1EE0-483A-ACA0-143C4F1ECD44@gmail.com \
--to=vitalywool@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=ddstreet@ieee.org \
--cc=khoroshilov@ispras.ru \
--cc=ldv-project@linuxtesting.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--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