linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Alexey Khoroshilov <khoroshilov@ispras.ru>
To: Matthew Wilcox <willy@infradead.org>
Cc: Vitaly Wool <vitalywool@gmail.com>,
	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: Sat, 11 Mar 2017 00:54:26 +0300	[thread overview]
Message-ID: <82e268d4-22fa-3e33-8988-a3a367fae7b1@ispras.ru> (raw)
In-Reply-To: <20170310213419.GD16328@bombadil.infradead.org>

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

  reply	other threads:[~2017-03-10 21:54 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 [this message]
2017-03-10 22:08     ` vitalywool

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=82e268d4-22fa-3e33-8988-a3a367fae7b1@ispras.ru \
    --to=khoroshilov@ispras.ru \
    --cc=akpm@linux-foundation.org \
    --cc=ddstreet@ieee.org \
    --cc=ldv-project@linuxtesting.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=vitalywool@gmail.com \
    --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