Received: by 2002:ab2:7903:0:b0:1fb:b500:807b with SMTP id a3csp1443839lqj; Tue, 4 Jun 2024 01:26:08 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVYz4wCEDOa+RqqxVdkonMwrKRud+81HSRG/AGrDS8RLiSJM9K2vRO6vjzv8J1AOQB4qV9/O7zf7tEyI+UGowPXiAkENhjejSVehSyw6w== X-Google-Smtp-Source: AGHT+IHA5lNr/UBRwj5CGZ+zKBrHywAU8vpTwKjxmFUEHEiMet8MJMc2uJ2BU/pbSSLWdlzqygJL X-Received: by 2002:a05:6358:5e09:b0:198:e44d:5174 with SMTP id e5c5f4694b2df-19b48e91807mr1415540855d.15.1717489567829; Tue, 04 Jun 2024 01:26:07 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717489567; cv=pass; d=google.com; s=arc-20160816; b=u9XlCnhIzAtrk0f1vc2YL0MHsrdc/5bo69GAIpS6m7Nc6yLFziNDQPM++g3NPAvQg2 PvYaY4ijHWy1ECEXNEybTbcGmCfbi4cUc+mZAQkVk8Ucsas09dj78br6SDW6HCup5k0d fuh/x2WTFenH3SPwtvJmfXJaasjLh3rGAxiy4Ot2RUultH13ItfZ7SWcjr6uLE89H2gk 51tPYSlrUU1by2+UOJHpXN9/O3JMDSCM57YH4hgnBaeTJ0dNd5I8HZKCztmKCfVtrVYA aKaRAdRWvQx3tJ20rEwOnJ0d1EkC5IMpnVBY8GVZnOYkT0LZcmfDbKr0py2FOsiFu7BR EjLA== 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=L6lmGhh2mmH9xiMqt/TccnGyxfRKcpMSgbXuk5MLT+c=; fh=qJhV2Vo6cFYFqz50To+3fz26CzjxMTBn2MHKM2rWDRE=; b=q8GLvHmowpnK9VO3E8MlDPzXNHZyn6aLvgmtCil2dm0wz7Prl6qIigCP0H2LTnv3It W4TLDiLQFwExc90M9KBYa+C5+1AdEcGZlOI4bB3ttIZPSau6mBRR/AAfPagKGm4hODKO YDpLzS0eCI/D0DNYLmlrAYQZo97KlbZ/g/6+DaE+tVJ4G5S2WQ6SMDKHv0qx8k9m/+SY he7Zm6mNlDUWfTnyVIYvh63BZFNGcoBpeZGF8kWoBqTcSN/zkEpI6MOwQkISVhWqq1bS QvmkyX1S87Hos8PPlc4LLBtFrySfQz/KTXkyAm7ssf9MIijgXs5pfA0IZRmG0p+pHijn xlCA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@126.com header.s=s110527 header.b=KXH20xxd; 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-200247-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-200247-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. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id 41be03b00d2f7-6c359e09db3si1018552a12.423.2024.06.04.01.26.07 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 04 Jun 2024 01:26:07 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-200247-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@126.com header.s=s110527 header.b=KXH20xxd; 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-200247-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-200247-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 71436284D1C for ; Tue, 4 Jun 2024 08:26:07 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id E0CFA142654; Tue, 4 Jun 2024 08:26:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=126.com header.i=@126.com header.b="KXH20xxd" Received: from m16.mail.126.com (m16.mail.126.com [220.197.31.8]) by smtp.subspace.kernel.org (Postfix) with ESMTP id ADEEA13C672 for ; Tue, 4 Jun 2024 08:25:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=220.197.31.8 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717489560; cv=none; b=BZLxovANV6pBzg3PjcbjBBUVMdI0UxFXS7kKPwggqexNi3h+021MJDif2g4+7lIj+/SF4X5oLJsqARS/JoxoEEif5EPcwui3aFXhe45UcuJhHW+Jcl/lH9w85/OhXThf4fVKmET9i+ZtPQjMF+deaK0xj15VerFwoihHFcW9W6I= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717489560; c=relaxed/simple; bh=Lsvp21eluqUR+nNFHRgYZYvdJf0Ss2HATtMd4tk741I=; h=From:To:Cc:Subject:Date:Message-Id; b=Ky2r1b5dmn7MwUzPKyGVbFTEElTjEay///pvzK2uIfPHnT7d2eHsO5TQITt+5WMSMQTrTIdIlttsp7ifiok80o1wvNcDO/i149mCsiwaT14xm34aIKnKVOK5pf+M2ZZf+UGoS2oTVDOJUqxmA1y/NiIgyJW0I1pPE0235zzKELM= 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=KXH20xxd; arc=none smtp.client-ip=220.197.31.8 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=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-CM-SenderInfo: 51dqwwjhrrila6rslhhfrp/1tbiWQXzG2VLajBwFQAAsl 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 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; } -- 2.7.4