mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Vitaly Wool <vitalywool@gmail.com>
To: Guenter Roeck <linux@roeck-us.net>
Cc: LKML <linux-kernel@vger.kernel.org>,
	Andrew Morton <akpm@linux-foundation.org>,
	mawilcox@microsoft.com, asavery@chromium.org,
	gwendal@chromium.org
Subject: Re: Crashes/hung tasks with z3pool under memory pressure
Date: Mon, 16 Apr 2018 14:43:01 +0200	[thread overview]
Message-ID: <b241e25a-50a3-fefb-0443-ad6c0a200898@gmail.com> (raw)
In-Reply-To: <20180413175615.GA30242@roeck-us.net>

Hey Guenter,

On 04/13/2018 07:56 PM, Guenter Roeck wrote:

> On Fri, Apr 13, 2018 at 05:40:18PM +0000, Vitaly Wool wrote:
>> On Fri, Apr 13, 2018, 7:35 PM Guenter Roeck <linux@roeck-us.net> wrote:
>>
>>> On Fri, Apr 13, 2018 at 05:21:02AM +0000, Vitaly Wool wrote:
>>>> Hi Guenter,
>>>>
>>>>
>>>> Den fre 13 apr. 2018 kl 00:01 skrev Guenter Roeck <linux@roeck-us.net>:
>>>>
>>>>> Hi all,
>>>>> we are observing crashes with z3pool under memory pressure. The kernel
>>>> version
>>>>> used to reproduce the problem is v4.16-11827-g5d1365940a68, but the
>>>> problem was
>>>>> also seen with v4.14 based kernels.
>>>>
>>>> just before I dig into this, could you please try reproducing the errors
>>>> you see with https://patchwork.kernel.org/patch/10210459/ applied?
>>>>
>>> As mentioned above, I tested with v4.16-11827-g5d1365940a68, which already
>>> includes this patch.
>>>
>> Bah. Sorry. Expect an update after the weekend.
>>
> NP; easy to miss. Thanks a lot for looking into it.
>
I wonder if the following patch would make a difference:

diff --git a/mm/z3fold.c b/mm/z3fold.c
index c0bca6153b95..5e547c2d5832 100644
--- a/mm/z3fold.c
+++ b/mm/z3fold.c
@@ -887,19 +887,21 @@ static int z3fold_reclaim_page(struct z3fold_pool *pool, unsigned int retries)
  				goto next;
  		}
  next:
-		spin_lock(&pool->lock);
  		if (test_bit(PAGE_HEADLESS, &page->private)) {
  			if (ret == 0) {
-				spin_unlock(&pool->lock);
  				free_z3fold_page(page);
  				return 0;
  			}
-		} else if (kref_put(&zhdr->refcount, release_z3fold_page)) {
-			atomic64_dec(&pool->pages_nr);
-			spin_unlock(&pool->lock);
-			return 0;
+		} else {
+			spin_lock(&zhdr->page_lock);
+			if (kref_put(&zhdr->refcount, release_z3fold_page_locked)) {
+				atomic64_dec(&pool->pages_nr);
+				return 0;
+			}
+			spin_unlock(&zhdr->page_lock);
  		}
  
+		spin_lock(&pool->lock);
  		/*
  		 * Add to the beginning of LRU.
  		 * Pool lock has to be kept here to ensure the page has


Thanks,
    Vitaly

  reply	other threads:[~2018-04-16 12:43 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-04-12 22:01 Guenter Roeck
2018-04-13  5:21 ` Vitaly Wool
2018-04-13 17:35   ` Guenter Roeck
     [not found]     ` <CAMJBoFPXObpXyQWz-zPJ7JnC-Z5FqqrLfr5BFWKdh+szZrPZ7A@mail.gmail.com>
2018-04-13 17:56       ` Guenter Roeck
2018-04-16 12:43         ` Vitaly Wool [this message]
2018-04-16 15:58           ` Guenter Roeck
2018-04-16 22:14             ` Vitaly Wool
2018-04-16 22:37               ` Guenter Roeck
2018-04-17 14:00 Vitaly Wool
2018-04-17 16:35 ` Guenter Roeck
2018-04-18  8:13 ` Vitaly Wool
2018-04-18 16:07   ` Guenter Roeck
     [not found]     ` <CAMJBoFO9ktEHK=e=Dkq99tNNKHM1iPuxUJ5bmyoX_bzjGwOmig@mail.gmail.com>
2018-04-27 17:18       ` Guenter Roeck

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=b241e25a-50a3-fefb-0443-ad6c0a200898@gmail.com \
    --to=vitalywool@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=asavery@chromium.org \
    --cc=gwendal@chromium.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@roeck-us.net \
    --cc=mawilcox@microsoft.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

all inboxes | Powered by JetHome®