From patchwork Tue Jun 4 08:09:11 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ge Yang X-Patchwork-Id: 13684884 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id CDBAEC25B7E for ; Tue, 4 Jun 2024 08:09:40 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 4932C6B0093; Tue, 4 Jun 2024 04:09:40 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 443026B0096; Tue, 4 Jun 2024 04:09:40 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 332386B009A; Tue, 4 Jun 2024 04:09:40 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id 15F5D6B0093 for ; Tue, 4 Jun 2024 04:09:40 -0400 (EDT) Received: from smtpin11.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id B5FF04107B for ; Tue, 4 Jun 2024 08:09:39 +0000 (UTC) X-FDA: 82192482078.11.DABAE78 Received: from m16.mail.126.com (m16.mail.126.com [220.197.31.7]) by imf04.hostedemail.com (Postfix) with ESMTP id 133524000A for ; Tue, 4 Jun 2024 08:09:36 +0000 (UTC) Authentication-Results: imf04.hostedemail.com; dkim=pass header.d=126.com header.s=s110527 header.b=KXH20xxd; spf=pass (imf04.hostedemail.com: domain of yangge1116@126.com designates 220.197.31.7 as permitted sender) smtp.mailfrom=yangge1116@126.com; dmarc=pass (policy=none) header.from=126.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1717488577; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:content-type: content-transfer-encoding:in-reply-to:references:dkim-signature; bh=L6lmGhh2mmH9xiMqt/TccnGyxfRKcpMSgbXuk5MLT+c=; b=64BIuCD0/Eo67jFtSRdorNhARG79Rxeh54gB5OkhHq2eMgDwDkvVU8ZeMjiHR5JZctCq4D 31PzIyRxzCNzTsKm+n/2ROnIc9hCk1f9c8t555v5OOXPCHylnVy5OlQ1RtY6UKB67ByXng a7sorCLQL+J/fx7xsULL4woR6LqSSPo= ARC-Authentication-Results: i=1; imf04.hostedemail.com; dkim=pass header.d=126.com header.s=s110527 header.b=KXH20xxd; spf=pass (imf04.hostedemail.com: domain of yangge1116@126.com designates 220.197.31.7 as permitted sender) smtp.mailfrom=yangge1116@126.com; dmarc=pass (policy=none) header.from=126.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1717488577; a=rsa-sha256; cv=none; b=noUZSAL25H5kx7xKtOwvnTiJj0tOVtUZFrj3qxjNvNyLtYMyBiSC1nMyd9cmU88oXjNEUZ fVI6Aq9CzCudkl8sDBhu2h07pXvsG6bMotWi0LJUJw0gXs3cnFf1NMvBBwgoIDuLMqkCCY fpuGZoTDZq5yPE+0BBiiSifTndecRF4= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=126.com; s=s110527; h=From:Subject:Date:Message-Id; bh=L6lmGhh2mmH9xiMqt/ TccnGyxfRKcpMSgbXuk5MLT+c=; b=KXH20xxdlPbAqmmc+zexY21DZlYu5xUzmj +7M48wxoBSlKKmfmNPAWcPDRsZVD8NGvQ1eUefvPXKECDWUlo2bBY/QJN/nBt6+e xVIEcp2KKW6tgceg+Rbyj3V/UO4v1i+aJVkAKfp3Q16mMrwdSYnEuWqtXdcZWLCR 91vxGLnL4= Received: from hg-OptiPlex-7040.hygon.cn (unknown [118.242.3.34]) by gzga-smtp-mta-g1-5 (Coremail) with SMTP id _____wBHh0S5y15mXcy4Cw--.308S2; Tue, 04 Jun 2024 16:09:29 +0800 (CST) From: yangge1116@126.com To: akpm@linux-foundation.org Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, baolin.wang@linux.alibaba.com, liuzixing@hygon.cn, yangge Subject: [PATCH] mm/gup: don't check page lru flag before draining it Date: Tue, 4 Jun 2024 16:09:11 +0800 Message-Id: <1717488551-18053-1-git-send-email-yangge1116@126.com> X-Mailer: git-send-email 2.7.4 X-CM-TRANSID: _____wBHh0S5y15mXcy4Cw--.308S2 X-Coremail-Antispam: 1Uf129KBjvdXoW7XrWktw4rXFW7Gw18ArW5Wrg_yoWDGFb_Ga 1DtFy8uan8XrZxZFyY93ySqrZrWasxCr4DGFy5Xr12ya45Xrn8WF1kAF43tFWxWw12vF9a gry5ArsxCwn2vjkaLaAFLSUrUUUUjb8apTn2vfkv8UJUUUU8Yxn0WfASr-VFAUDa7-sFnT 9fnUUvcSsGvfC2KfnxnUUI43ZEXa7IU8g6pJUUUUU== X-Originating-IP: [118.242.3.34] X-CM-SenderInfo: 51dqwwjhrrila6rslhhfrp/1tbiWQXzG2VLajBwFQAAsl X-Stat-Signature: ggggoqtt4z7i13qewuufjzmdwrcmqc5x X-Rspamd-Queue-Id: 133524000A X-Rspam-User: X-Rspamd-Server: rspam10 X-HE-Tag: 1717488576-526627 X-HE-Meta: U2FsdGVkX19gWpTdHVCpQVgvXXDXrbWgncTE3kEwvDgC08Ztutc7l12PtxHiQIYpH/RE4MjtiKJFmb4ru/bPg+dnLUm7/MJImo5XvW6eH7OXc6A7Ax/jObKbZXFAPkJ7yWNSRA2UMSvEu6GUEu2/lc241kvSYBKBtQTUkeJcwFXLWnTeE5+75GL+7oOFtCnWB8wkNKW5cPuCAmimuglPchRNOCqNMpi1fpiD1KnAh1RG48UvgL0bYvjMIo6U4w+HTF6aTIhaOpUb8Kqir88ILFU03uDFrZB0J/N2Anig8cGkQiDdK1pcy35aD6U3e5rArMVTkiPNVqhUMqtWwW5hnqEruQmKCLZRNqanlE6ZbL2KIqaKEhIiSv9tmc8rEPLovgK8vi4QdUgE00ywX1eDJISrIOi3xQeIL4hS2/QbyN04XsKTXpi+aG+Vg+GivQoz3UWg0cB618Mm1BPY5retqDXTEAmcxj7epcaxskafMefOcq9lUt28P3VaJQBN56YFQDw1Y/hqjgGrw9ER8lPfLf31isDkEi3h1OqMxHAytq7XiG/Vp4NVEJawyblCC+kok1t0Mdwb7EblKvRukRCG/8hyF1JK+j/gHXP9Yw/yOJgS7I/MzzLno/zWHTZSOizLEUzXkXNYDB8Dqr1Pveg5U7FQeaUCoMhWv/3AtSZc/GA5+OF3GGcw9Wj05Y0ZOPMKtTg13rA9QUqMWIB4LOznZFRp5OY8/oVSq/aYdIjNktTYd91ESm2hYt3ciKa5+31FJ6mtektvCIYfqyRKX5o1a2KBtPd9n/KDfh9IfqJH9h2XDyaNmQcxAHeuZMDHB4sh2dodePB7xOnlQK/+yWuz7KHedqDe1apt8bqYSA8WqtSJ8gFgiti43oH39+tbGG77lf7oRVkVFmBJEABK84oIlZwvBD6Ua6fHaVmZWO6NYYRVHz1MsFAIWGFkzus5f5MEo6FRadCQJRk8XxTevJ1 JutW9twX I0k+DYpvJNdHy8jiggDoyYu89cB+gBVTa4i2pput4LvTGZ2HVb3a8eTOphofOIWjW8A9YGomkp5UmTuAMGwL6YrFO6uHzRJTpLbHcx2T1WgAV6/7fpLRaMqQWdbA8RgDr49CHQ7Efbr55yD/LbZK82ny+kVj595qIIeGGZhJ/1FVWlJlVRS2Teb7oAzjYzFaDu+0vBYbidJ5V+YZuw46CdKEr4CNhvFJFB5aqQENJVzrgVWJ5ZNKa9IvKu8eu53m9Ntzl X-Bogosity: Ham, tests=bogofilter, spamicity=0.000013, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: From: yangge If a page is added in pagevec, its ref count increases one, remove the page from pagevec decreases one. Page migration requires the page is not referrened by others except page mapping. Before migrating a page, we should try to drain the page from pagevec in case the page is in it, however, folio_test_lru() is not sufficient to tell whether the page is in pagevec or not, if the page is in pagevec, the migration will fail. Remove the condition and drain lru once to ensure the page is not referrenced by pagevec. Signed-off-by: yangge --- mm/gup.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mm/gup.c b/mm/gup.c index ca0f5ce..890dcbc 100644 --- a/mm/gup.c +++ b/mm/gup.c @@ -2411,7 +2411,7 @@ static unsigned long collect_longterm_unpinnable_pages( continue; } - if (!folio_test_lru(folio) && drain_allow) { + if (drain_allow) { lru_add_drain_all(); drain_allow = false; }