Received: by 2002:ab2:69cc:0:b0:1fd:c486:4f03 with SMTP id n12csp282240lqp; Tue, 11 Jun 2024 04:39:54 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXYYiPp5d3lCDn8D/Bb0n+zTTIgnvJyFHlrczTL5DH+yk6QWUx7UT/CtIOlplgGXObvaiQNYLnkJmLuCUHximSrXEXt3CbFv31nBoaE1A== X-Google-Smtp-Source: AGHT+IH14emp/7LG9eGWsh6KM0nfOvl9NzgFUc/W1k0MJ7LiFMoHVT3pJdUFo5Y1KzIhnZeAT3Tb X-Received: by 2002:a05:6a20:244f:b0:1b8:2211:b7e0 with SMTP id adf61e73a8af0-1b82211b983mr4737427637.20.1718105993853; Tue, 11 Jun 2024 04:39:53 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1718105993; cv=pass; d=google.com; s=arc-20160816; b=esYenQW2msKBMyzRkm1kGLSXZgAQuZjxVCpX+jmxIO7A6eQxpGa2nGKTG2zb8Em9bF vkHhid7spnoZswKg7CY+I7f6LRDjFWSkJYPAmiEWPdsTWHOQp6O9Co+em7hzB9EnRduX NE9G/+0kT1H/90IOHSPJ1Cg9GpooZRyO0sReRUITJI7FNFPvXtiFtWd3D7jy82FM9Jku 5oDu6xGJo9lIFSQbC19y3ZXq9r9Th5VwAeugubDxlIprQDt7kD4w/D5JmFVgJHNo5ghG 067H5emFWhIfgdfeNWgoYf47n0fVENpLTNCTgQrFzK2Xezr2lJcfWAPfJ+4mMQ3cHE+I RpiA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:content-language:in-reply-to:mime-version :list-unsubscribe:list-subscribe:list-id:precedence:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature; bh=jCFqd3LXs39+VvrrsYj4pOe0n5oGnuB0OD0gS2ysprA=; fh=iAybor5nZ2lqQTReGpjqRUtMP7aJIo11x9cj1pdMbvY=; b=fhTokJXfa7f8qdv5No1vKWkCSx3Eq4T8BRfbwdJmO8bnC7UWLDN9RXihlSkv8sifhC CaVVAUDHhPJzhNY4jmR+f6MBfkjFwld6GAQGj6aal5X/POAL68DZeszX9kGKE8VQ490O NirLl6bTW8SkbvF+yLSzVZe6vMhW8xuM+lzwzlgAkeuzaMXZynrjj8BChNL2F01vHebl Ql3ZGyRjm0yLpJWLiRPesZKkTsYddrrv7sUqt9+tric/ZAFboy6FLlu/+wd/rxcoO3+h nyJF7DcjQYAbc0Gcz34e634N1SsqZz4dW78EgCbmAnB8IigPSEx5FSI6O/hMVl85TTEQ Odfw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@126.com header.s=s110527 header.b=Q9xyf6WE; 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-209772-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-209772-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 d2e1a72fcca58-70426469c07si5531975b3a.154.2024.06.11.04.39.53 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 11 Jun 2024 04:39:53 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-209772-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=Q9xyf6WE; 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-209772-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-209772-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 6B1D328204D for ; Tue, 11 Jun 2024 11:39:53 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 7BD8017C7A6; Tue, 11 Jun 2024 11:36:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=126.com header.i=@126.com header.b="Q9xyf6WE" Received: from m16.mail.126.com (m16.mail.126.com [117.135.210.6]) by smtp.subspace.kernel.org (Postfix) with ESMTP id D7A5417D8B5 for ; Tue, 11 Jun 2024 11:36:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=117.135.210.6 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718105779; cv=none; b=ffpeeD1y2iCEBn+nx47KymlWvqkWd4vAoXchErW+sNsoVtFPnQSzXBTJgsKZ9j7CBT9Rp2+hZHgPpVxJBjsCDuuxRxV3DcrBqGCSUlJeDegtxkJa4Rc6MdI5tyU7xzuzSy8/ZZhv4mpJjKZ6Ljwyxjfr+YL+wM+ZjHP9KNXcxIM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718105779; c=relaxed/simple; bh=KRwPXUn6DQRf5xXAQc1WpIgnWvp45Pqu02uX4Li/3dM=; h=Subject:To:Cc:References:From:Message-ID:Date:MIME-Version: In-Reply-To:Content-Type; b=e2RZUE79ZdF06DbB5qH1TYn2h21cS0tcBnq0/IxM7Yl+rJ3aDdHE63R1/IuIOybjeXD+gqazCej9owcM4/gEru2mZiEPl36tF5L4+5WZH7j7gVhO0xzFg8vlCALRcpYxz00GvUt3KXf2KZfExVouyDzMyTVLkoy3Mu2za9zOfDI= 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=Q9xyf6WE; arc=none smtp.client-ip=117.135.210.6 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=Subject:From:Message-ID:Date:MIME-Version: Content-Type; bh=jCFqd3LXs39+VvrrsYj4pOe0n5oGnuB0OD0gS2ysprA=; b=Q9xyf6WEfnTLzKNsjSajrV4DhpElAvfK3VOG7PXv3jYMGiQfKaIOQeZdf/Xkd1 PXKdhwwCfiO9rMSC9GQHh2Ntb88Yo9J7km1E7j5FXk+eqkMZwj2MvU6Vo+HkGphH 9hRIP5IjiEUiz+p22vaUOK3SaKMZjz4Ax+auc2hmibyew= Received: from [172.21.21.216] (unknown [118.242.3.34]) by gzga-smtp-mta-g1-3 (Coremail) with SMTP id _____wDXvw77Mmhm7thyAw--.44907S2; Tue, 11 Jun 2024 19:20:28 +0800 (CST) Subject: Re: [PATCH] mm/gup: don't check page lru flag before draining it To: David Hildenbrand , Matthew Wilcox Cc: Baolin Wang , akpm@linux-foundation.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, liuzixing@hygon.cn References: <0d7a4405-9a2e-4bd1-ba89-a31486155233@redhat.com> <776de760-e817-43b2-bd00-8ce96f4e37a8@redhat.com> <7063920f-963a-4b3e-a3f3-c5cc227bc877@redhat.com> <48150a28-ed48-49ff-9432-9cd30cda4da4@linux.alibaba.com> <11ef3deb-d1e3-46d5-97ed-9ba3c1fbbba9@redhat.com> <697a9bc2-a655-4035-aa5e-7d3acb23e79d@redhat.com> <3a368e38-a4cb-413e-a6d9-41c6b3dbd5ae@redhat.com> <48fb0e58-16d1-7956-cf35-74741826617a@126.com> <617f9e36-9334-4630-a6b9-473f2dd570d4@redhat.com> From: yangge1116 Message-ID: <8351052a-5c21-c383-544b-3166e883587c@126.com> Date: Tue, 11 Jun 2024 19:20:26 +0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 In-Reply-To: <617f9e36-9334-4630-a6b9-473f2dd570d4@redhat.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit X-CM-TRANSID:_____wDXvw77Mmhm7thyAw--.44907S2 X-Coremail-Antispam: 1Uf129KBjvJXoW7uF1xWr47XrW7urWrZFyUGFg_yoW8Gw1kpF 18KF98GF4qkryayFn2gwnrArsay3yrXFW5AFy3Zry7CF4DXF1a9rW0qa15CFy3Jr4Sqr1I ya1jq3WkuF15ZaDanT9S1TB71UUUUU7qnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDUYxBIdaVFxhVjvjDU0xZFpf9x07b0eOJUUUUU= X-CM-SenderInfo: 51dqwwjhrrila6rslhhfrp/1tbiGA36G2VLbs-xaAAAsi 在 2024/6/9 上午12:03, David Hildenbrand 写道: > On 08.06.24 17:15, Matthew Wilcox wrote: >> On Sat, Jun 08, 2024 at 12:38:49PM +0800, yangge1116 wrote: >>> Can we add a PG_lru_batch flag to determine whether a page is in lru >>> batch? >>> If we can, seems this problem will be easier. >> >> Page flags are in short supply.  You'd need a really good justification. >> > > A flag would not be able to handle the "part of multiple LRU batches" > that should currently possible (when to clear the flag?). Well, if we > have to keep supporting that. If we only to be part in a single LRU > batch, a new flag could work and we could still allow isolating a folio > from LRU while in some LRU batch. Yes, before adding a folio to LRU batch, check whether the folio has been added. Add the folio to LRU batch only if the folio has not been added. > > If we could handle it using the existing flags, that would of course be > better (wondering if we could store more information in the existing > flags by using a different encoding for the different states). If a folio contains more than one page, the folio will not be added to LRU batch. Can we use folio_test_large(folio) to filter? if (!folio_test_large(folio) && drain_allow) { lru_add_drain_all(); drain_allow = false; } > > The temporary clearing of the LRU flag we do right now tells me that > it's already not 100% reliable, so the question is how much more > unreliable we can make it before it would hurt :) >