Received: by 2002:a05:7208:2202:b0:86:316c:7444 with SMTP id s2csp2379245rbb; Tue, 4 Jun 2024 03:50:02 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWF+pBW9/tRLiFAanmN1nUKE/O7WVzutV9hq6GEAuE4KAyn/lc2vImo+8DDoWz3ppz8XkO0DNbYuiSvKICyaxjq9EBYqRRnkyocIexYfA== X-Google-Smtp-Source: AGHT+IGiazMKbXDBGvwC1m4dkhc0/s797hjMWrG1viOloAEowaaWrQ5Gbit/mjLjTJC60iF24yM7 X-Received: by 2002:a05:6a20:979a:b0:1af:6428:1812 with SMTP id adf61e73a8af0-1b2a2b616f7mr2406273637.4.1717498202387; Tue, 04 Jun 2024 03:50:02 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717498202; cv=pass; d=google.com; s=arc-20160816; b=A17mmTahOf9P0o1xkZd7d61Kiqf38IIZbukpUwcZ6V4Q6l5722oshDisUzg36te3wf 3++YSiyQnSAjAvVONMFOFK1n58/iVKv0/j8T4cpM8bh/1mkiY+b5ormAKJJeEpBK0L/Q 05/4bP+UmnsdCfQGuBz7Y8B7oCTY7/wXwR9FngjjL/x9ZX3rCnuFvp2PX1wkPsp/rhlU V2N80zv7coyaltjNqbq343liLQgu8q6sMbahn5Dpj2kH2p81bfJDB0hcyL70Vfwg+7Gw b+1LS8FuwMEwKBjvmEE43ZbJopXj9k2tZDiPYrmJWu5kapqlCCwdgv9QHAkWCt1sMxOe cuOA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-unsubscribe:list-subscribe:list-id:precedence:message-id:date :subject:cc:to:from:dkim-signature; bh=emKGznr4V0DNwDnZbLylce4/u/GthEKwTnfDwt4vDCE=; fh=qJhV2Vo6cFYFqz50To+3fz26CzjxMTBn2MHKM2rWDRE=; b=FPvZEu1/EgW2q+xz47UAQ3udz+AQnMljXFQlleBgtX8oZ4Ke3oPd18+tKMCVfhELFF /+BfIA/C9EwS1UFff/0wzkPz6mNEPdkm1icH87v4KtmT1wejm7p22H/7OZlwu54+otQG 6iRM+X6t8orvkNweXgHp/lLVjqY+7aT+YKuuypyApHqd6JpDkJNGtedMLYEhKK7ZFjiS /KwTN1fMIBHd3ip8fP/ERT3MFYwavri152eaW5nrrFtflZ+g+t8fohW/GnlW6cqrKAEp cL2LwdWHeoHawtkcT5hGkQ7DhaCqbOTU3XFADSO1KmUF/6qaHGkWFPE3kJzWEYfC6yKV f/sg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@126.com header.s=s110527 header.b=BB6j8MFP; arc=pass (i=1 spf=pass spfdomain=126.com dkim=pass dkdomain=126.com dmarc=pass fromdomain=126.com); spf=pass (google.com: domain of linux-kernel+bounces-200462-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-200462-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=126.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id 41be03b00d2f7-6c35a0e6c8esi7968926a12.401.2024.06.04.03.50.02 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 04 Jun 2024 03:50:02 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-200462-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@126.com header.s=s110527 header.b=BB6j8MFP; arc=pass (i=1 spf=pass spfdomain=126.com dkim=pass dkdomain=126.com dmarc=pass fromdomain=126.com); spf=pass (google.com: domain of linux-kernel+bounces-200462-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-200462-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=126.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id B2158281C4F for ; Tue, 4 Jun 2024 10:50:01 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 57623144D11; Tue, 4 Jun 2024 10:49:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=126.com header.i=@126.com header.b="BB6j8MFP" Received: from m16.mail.126.com (m16.mail.126.com [117.135.210.9]) by smtp.subspace.kernel.org (Postfix) with ESMTP id A45E713C67C for ; Tue, 4 Jun 2024 10:49:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=117.135.210.9 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717498196; cv=none; b=amTax781CLKPT9qlrHW5jVsrlcmYX8HJQwZrZtjhmF5mTlaacl2UxFFr5Wv3SV4efKFImT5XedtsDDvHVNb/mq7kiyCxUtEc7O5DqSktgdiJ4t8omxZqnqCdmnrShT6RxCGqbXoqzUb6A9uQ0hdfGiMBZgJ+KiSkJwVIgbSqpRQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717498196; c=relaxed/simple; bh=Dh0JzK0lXzkWe3f8aBs4uDAAXvnYwDB/LG4D6LTFPgw=; h=From:To:Cc:Subject:Date:Message-Id; b=aLIHiop6TesJ4nW7dcCetLFFv+UQbgf8Noqyp0o+unAVfcz+/vcoT+bTBB9dvyGVhUVBdPUunalTRFA37B/Z4fMnV0ctyUWmfO6FMR4bVPidMeDBHDHSdFDnxROL/3pHHO7ylskpOKu6fhw2J1kGnHojZpJ96a5GBhMAnUNZyuw= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=126.com; spf=pass smtp.mailfrom=126.com; dkim=pass (1024-bit key) header.d=126.com header.i=@126.com header.b=BB6j8MFP; arc=none smtp.client-ip=117.135.210.9 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=126.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=126.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=126.com; s=s110527; h=From:Subject:Date:Message-Id; bh=emKGznr4V0DNwDnZbL ylce4/u/GthEKwTnfDwt4vDCE=; b=BB6j8MFP5Fv95hli9V11jArmhseLDPr5zY qVIptYp+xHRgBg1DXDR9tt7/Dkl5Wpyn61gKSK7FwMZseEb2OZMjHjJixK+nwljg VM2xCI3AyCES27fQA5Cd1J1l3ExFVz8agbD6LPP3rXSMb2hpLCj0Z4tcxpkorwfw MT4uEqLmI= Received: from hg-OptiPlex-7040.hygon.cn (unknown [118.242.3.34]) by gzga-smtp-mta-g0-1 (Coremail) with SMTP id _____wDnjxYL8V5mY7QUAA--.8619S2; Tue, 04 Jun 2024 18:48:44 +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 18:48:41 +0800 Message-Id: <1717498121-20926-1-git-send-email-yangge1116@126.com> X-Mailer: git-send-email 2.7.4 X-CM-TRANSID:_____wDnjxYL8V5mY7QUAA--.8619S2 X-Coremail-Antispam: 1Uf129KBjvdXoW7XrWktw4rXFW7XF1rJrW3GFg_yoWDGFb_Ga 1Dta48uan8XrZrZa4jg3ySqrZrWasxCr4DGFy5Xr17Aa45Xrn8WF1kAF4ayFWxWw17ZF93 Wr98ArsxCwn2vjkaLaAFLSUrUUUUjb8apTn2vfkv8UJUUUU8Yxn0WfASr-VFAUDa7-sFnT 9fnUUvcSsGvfC2KfnxnUUI43ZEXa7IU045lUUUUUU== X-CM-SenderInfo: 51dqwwjhrrila6rslhhfrp/1tbiWQrzG2VLajM+uwAAsJ Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.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 referenced 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 referenced 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 e17466f..4fa739c 100644 --- a/mm/gup.c +++ b/mm/gup.c @@ -2460,7 +2460,7 @@ static unsigned long collect_longterm_unpinnable_folios( continue; } - if (!folio_test_lru(folio) && drain_allow) { + if (drain_allow) { lru_add_drain_all(); drain_allow = false; } -- 2.7.4