linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: "HORIGUCHI NAOYA(堀口 直也)" <naoya.horiguchi@nec.com>
To: Miaohe Lin <linmiaohe@huawei.com>
Cc: "akpm@linux-foundation.org" <akpm@linux-foundation.org>,
	"linux-mm@kvack.org" <linux-mm@kvack.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 2/6] mm, hwpoison: use __PageMovable() to detect non-lru movable pages
Date: Mon, 5 Sep 2022 05:22:45 +0000	[thread overview]
Message-ID: <20220905052243.GA1355682@hori.linux.bs1.fc.nec.co.jp> (raw)
In-Reply-To: <20220830123604.25763-3-linmiaohe@huawei.com>

Hi Miaohe,

On Tue, Aug 30, 2022 at 08:36:00PM +0800, Miaohe Lin wrote:
> It's more recommended to use __PageMovable() to detect non-lru movable
> pages. We can avoid bumping page refcnt via isolate_movable_page() for
> the isolated lru pages. Also if pages become PageLRU just after they're
> checked but before trying to isolate them, isolate_lru_page() will be
> called to do the right work.

Good point, non-lru movable page is currently handled by isolate_lru_page(),
which always fails.  This means that we lost the chance of soft-offlining
for any non-lru movable page.  So this patch improves the situation.

> 
> Signed-off-by: Miaohe Lin <linmiaohe@huawei.com>
> ---
>  mm/memory-failure.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/mm/memory-failure.c b/mm/memory-failure.c
> index a923a6dde871..3966fa6abe03 100644
> --- a/mm/memory-failure.c
> +++ b/mm/memory-failure.c
> @@ -2404,7 +2404,7 @@ EXPORT_SYMBOL(unpoison_memory);
>  static bool isolate_page(struct page *page, struct list_head *pagelist)
>  {
>  	bool isolated = false;
> -	bool lru = PageLRU(page);
> +	bool lru = !__PageMovable(page);

It seems that PAGE_MAPPING_MOVABLE is not set for hugetlb pages, so
lru becomes true for them.  Then, if isolate_hugetlb() succeeds,
inc_node_page_state() is called for hugetlb pages, maybe that's not expected.

>  
>  	if (PageHuge(page)) {
>  		isolated = !isolate_hugetlb(page, pagelist);
        } else {
                if (lru)
                        isolated = !isolate_lru_page(page);
                else
                        isolated = !isolate_movable_page(page, ISOLATE_UNEVICTABLE);

                if (isolated)
                        list_add(&page->lru, pagelist);
        }

        if (isolated && lru)
                inc_node_page_state(page, NR_ISOLATED_ANON +
                                    page_is_file_lru(page));

so, how about moving this if block into the above else block?
Then, the automatic variable lru can be moved into the else block.

Thanks,
Naoya Horiguchi

  reply	other threads:[~2022-09-05  5:22 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-30 12:35 [PATCH 0/6] A few cleanup patches for memory-failure Miaohe Lin
2022-08-30 12:35 ` [PATCH 1/6] mm, hwpoison: use ClearPageHWPoison() in memory_failure() Miaohe Lin
2022-09-05  5:23   ` HORIGUCHI NAOYA(堀口 直也)
2022-08-30 12:36 ` [PATCH 2/6] mm, hwpoison: use __PageMovable() to detect non-lru movable pages Miaohe Lin
2022-09-05  5:22   ` HORIGUCHI NAOYA(堀口 直也) [this message]
2022-09-05  6:53     ` Miaohe Lin
2022-09-05  7:15       ` HORIGUCHI NAOYA(堀口 直也)
2022-09-05  7:29         ` Miaohe Lin
2022-09-05 21:53           ` Andrew Morton
2022-09-06  1:07             ` Miaohe Lin
2022-08-30 12:36 ` [PATCH 3/6] mm, hwpoison: use num_poisoned_pages_sub() to decrease num_poisoned_pages Miaohe Lin
2022-09-05  5:24   ` HORIGUCHI NAOYA(堀口 直也)
2022-08-30 12:36 ` [PATCH 4/6] mm, hwpoison: avoid unneeded page_mapped_in_vma() overhead in collect_procs_anon() Miaohe Lin
2022-09-05  5:24   ` HORIGUCHI NAOYA(堀口 直也)
2022-08-30 12:36 ` [PATCH 5/6] mm, hwpoison: check PageTable() explicitly in hwpoison_user_mappings() Miaohe Lin
2022-09-05  5:25   ` HORIGUCHI NAOYA(堀口 直也)
2022-08-30 12:36 ` [PATCH 6/6] mm, hwpoison: cleanup some obsolete comments Miaohe Lin
2022-09-05  5:25   ` HORIGUCHI NAOYA(堀口 直也)

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=20220905052243.GA1355682@hori.linux.bs1.fc.nec.co.jp \
    --to=naoya.horiguchi@nec.com \
    --cc=akpm@linux-foundation.org \
    --cc=linmiaohe@huawei.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.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