linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Miaohe Lin <linmiaohe@huawei.com>
To: <akpm@linux-foundation.org>
Cc: <mike.kravetz@oracle.com>, <shy828301@gmail.com>,
	<willy@infradead.org>, <ying.huang@intel.com>, <ziy@nvidia.com>,
	<minchan@kernel.org>, <apopple@nvidia.com>,
	<dave.hansen@linux.intel.com>, <o451686892@gmail.com>,
	<jhubbard@nvidia.com>, <peterx@redhat.com>,
	<naoya.horiguchi@nec.com>, <mhocko@suse.com>, <riel@redhat.com>,
	<osalvador@suse.de>, <david@redhat.com>, <sfr@canb.auug.org.au>,
	<linux-mm@kvack.org>, <linux-kernel@vger.kernel.org>,
	<linmiaohe@huawei.com>
Subject: [PATCH 2/4] mm/migration: remove unneeded lock page and PageMovable check
Date: Sat, 9 Apr 2022 15:38:44 +0800	[thread overview]
Message-ID: <20220409073846.22286-3-linmiaohe@huawei.com> (raw)
In-Reply-To: <20220409073846.22286-1-linmiaohe@huawei.com>

When non-lru movable page was freed from under us, __ClearPageMovable must
have been done. Even if it's not done, ClearPageIsolated here won't hurt
as page will be freed anyway. So we can thus remove unneeded lock page and
PageMovable check here.

Signed-off-by: Miaohe Lin <linmiaohe@huawei.com>
---
 mm/migrate.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/mm/migrate.c b/mm/migrate.c
index d8aae6c75990..381963231a62 100644
--- a/mm/migrate.c
+++ b/mm/migrate.c
@@ -1098,12 +1098,8 @@ static int unmap_and_move(new_page_t get_new_page,
 		/* page was freed from under us. So we are done. */
 		ClearPageActive(page);
 		ClearPageUnevictable(page);
-		if (unlikely(__PageMovable(page))) {
-			lock_page(page);
-			if (!PageMovable(page))
-				ClearPageIsolated(page);
-			unlock_page(page);
-		}
+		if (unlikely(__PageMovable(page)))
+			ClearPageIsolated(page);
 		goto out;
 	}
 
-- 
2.23.0


  parent reply	other threads:[~2022-04-09  7:38 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-09  7:38 [PATCH 0/4] A few cleanup and fixup patches for migration Miaohe Lin
2022-04-09  7:38 ` [PATCH 1/4] mm/migration: reduce the rcu lock duration Miaohe Lin
2022-04-11 14:09   ` Christoph Hellwig
2022-04-12  2:07   ` ying.huang
2022-04-12  3:21     ` Miaohe Lin
2022-04-09  7:38 ` Miaohe Lin [this message]
2022-04-11 14:09   ` [PATCH 2/4] mm/migration: remove unneeded lock page and PageMovable check Christoph Hellwig
2022-04-09  7:38 ` [PATCH 3/4] mm/migration: return errno when isolate_huge_page failed Miaohe Lin
2022-04-11 14:10   ` Christoph Hellwig
2022-04-12  3:13     ` Miaohe Lin
2022-04-09  7:38 ` [PATCH 4/4] mm/migration: fix potential pte_unmap on an not mapped pte Miaohe Lin
2022-04-09 11:38   ` kernel test robot
2022-04-11  1:54     ` Miaohe Lin
2022-04-11 11:41   ` David Hildenbrand
2022-04-12  2:55     ` Miaohe Lin
2022-04-12  2:25 ` [PATCH 0/4] A few cleanup and fixup patches for migration ying.huang
2022-04-12  3:29   ` Miaohe Lin
2022-04-12  6:33     ` ying.huang
2022-04-12  8:59       ` Miaohe Lin
2022-04-12  7:00     ` ying.huang
2022-04-12  9:06       ` Miaohe Lin

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=20220409073846.22286-3-linmiaohe@huawei.com \
    --to=linmiaohe@huawei.com \
    --cc=akpm@linux-foundation.org \
    --cc=apopple@nvidia.com \
    --cc=dave.hansen@linux.intel.com \
    --cc=david@redhat.com \
    --cc=jhubbard@nvidia.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mhocko@suse.com \
    --cc=mike.kravetz@oracle.com \
    --cc=minchan@kernel.org \
    --cc=naoya.horiguchi@nec.com \
    --cc=o451686892@gmail.com \
    --cc=osalvador@suse.de \
    --cc=peterx@redhat.com \
    --cc=riel@redhat.com \
    --cc=sfr@canb.auug.org.au \
    --cc=shy828301@gmail.com \
    --cc=willy@infradead.org \
    --cc=ying.huang@intel.com \
    --cc=ziy@nvidia.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;
as well as URLs for NNTP newsgroup(s).