linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Matthew Wilcox <willy@infradead.org>
To: Alexey Khoroshilov <khoroshilov@ispras.ru>
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: Fri, 10 Mar 2017 13:34:19 -0800	[thread overview]
Message-ID: <20170310213419.GD16328@bombadil.infradead.org> (raw)
In-Reply-To: <1489180932-13918-1-git-send-email-khoroshilov@ispras.ru>

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

--
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:34 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 [this message]
2017-03-10 21:54   ` Alexey Khoroshilov
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=20170310213419.GD16328@bombadil.infradead.org \
    --to=willy@infradead.org \
    --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=vitalywool@gmail.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