linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: SeongJae Park <sj@kernel.org>
Cc: SeongJae Park <sj@kernel.org>,
	Andrew Morton <akpm@linux-foundation.org>,
	Matthias Brugger <matthias.bgg@gmail.com>,
	AngeloGioacchino Del Regno
	<angelogioacchino.delregno@collabora.com>,
	wsd_upstream@mediatek.com, casper.li@mediatek.com,
	"andrew . yang" <andrew.yang@mediatek.com>,
	stable@vger.kernel.org, damon@lists.linux.dev,
	linux-mm@kvack.org, linux-kernel@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org,
	linux-mediatek@lists.infradead.org
Subject: Re: [PATCH v3] mm/damon/paddr: fix missing folio_put()
Date: Wed, 22 Feb 2023 18:26:53 +0000	[thread overview]
Message-ID: <20230222182653.156921-1-sj@kernel.org> (raw)
In-Reply-To: <20230222064223.6735-1-andrew.yang@mediatek.com>

Hi Andrew,


Thank you for revising this patch!

> From: "andrew.yang" <andrew.yang@mediatek.com>
> 
> damon_get_folio() would always increase folio _refcount and
> folio_isolate_lru() would increase folio _refcount if the folio's lru
> flag is set.
> 
> If an unevictable folio isolated successfully, there will be two more
> _refcount. The one from folio_isolate_lru() will be decreased in
> folio_puback_lru(), but the other one from damon_get_folio() will be
> left behind. This causes a pin page.
> 
> Whatever the case, the _refcount from damon_get_folio() should be
> decreased.
> 
> Signed-off-by: andrew.yang <andrew.yang@mediatek.com>
> Fixes: 57223ac29584 ("mm/damon/paddr: support the pageout scheme")
> Cc: <stable@vger.kernel.org> # 5.16.x

Reviewed-by: SeongJae Park <sj@kernel.org>

This may not cleanly applicable on 6.1.y and 6.2.y.  I would post backports
once this is merged in the mainline, unless others do earlier than me.


Thanks,
SJ

> ---
> v3:
>   add fixes tag and cc stable
> v2:
>   according to David's suggestion
>     1. revise subject
>   according to SeongJae's suggestions
>     1. rebase to mm-unstable tree 
>     2. remove braces for th single statements
> ---
>  mm/damon/paddr.c | 7 +++----
>  1 file changed, 3 insertions(+), 4 deletions(-)
> 
> diff --git a/mm/damon/paddr.c b/mm/damon/paddr.c
> index 607bb69e526c..6c655d9b5639 100644
> --- a/mm/damon/paddr.c
> +++ b/mm/damon/paddr.c
> @@ -250,12 +250,11 @@ static unsigned long damon_pa_pageout(struct damon_region *r, struct damos *s)
>  			folio_put(folio);
>  			continue;
>  		}
> -		if (folio_test_unevictable(folio)) {
> +		if (folio_test_unevictable(folio))
>  			folio_putback_lru(folio);
> -		} else {
> +		else
>  			list_add(&folio->lru, &folio_list);
> -			folio_put(folio);
> -		}
> +		folio_put(folio);
>  	}
>  	applied = reclaim_pages(&folio_list);
>  	cond_resched();
> -- 
> 2.18.0
> 
> 


      reply	other threads:[~2023-02-22 18:27 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-22  6:42 Andrew Yang
2023-02-22 18:26 ` SeongJae Park [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=20230222182653.156921-1-sj@kernel.org \
    --to=sj@kernel.org \
    --cc=akpm@linux-foundation.org \
    --cc=andrew.yang@mediatek.com \
    --cc=angelogioacchino.delregno@collabora.com \
    --cc=casper.li@mediatek.com \
    --cc=damon@lists.linux.dev \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mediatek@lists.infradead.org \
    --cc=linux-mm@kvack.org \
    --cc=matthias.bgg@gmail.com \
    --cc=stable@vger.kernel.org \
    --cc=wsd_upstream@mediatek.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