Received: by 2002:a05:6500:1b45:b0:1f5:f2ab:c469 with SMTP id cz5csp1258301lqb; Thu, 18 Apr 2024 05:07:58 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXaSsGhAVGrh9rOnN9EsMDtsbC8yX4+Vbrms1n6vg6hQyCsevmJp3le6VthgbbHq9boJIwK7nQH9a4y3XSfDkb/0g36yAu7qBrXpQ0yHg== X-Google-Smtp-Source: AGHT+IE15FoDe53z6REh84zTXqhVjNXbFfWJqlxSHRGNHczrzsOtvlDqtfw0ot/vbtMBTwNtaPyW X-Received: by 2002:a05:6a20:da9c:b0:1a3:bfce:ec9e with SMTP id iy28-20020a056a20da9c00b001a3bfceec9emr3431527pzb.18.1713442077970; Thu, 18 Apr 2024 05:07:57 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1713442077; cv=pass; d=google.com; s=arc-20160816; b=KXle08SVTDOys2bfJfNoXtvk/qXTMx2rutXaV3kuyb+M1hntfNUQyNwsXkqbQDRP2M pwupJZsPKK4gF/hSIvbDFISY8I+E2qeWR5eagLCOL+Fj9oY9K+ax2Cpcxy+I87ZweiVp 7M4EOT8s3yHY6b+mR5SXjdX+1VWn7zC04PbLyuHmiWeALaaYZUe11XBhcdVpUkqZiIdN 4FXmvzZPaq86qs+srHBHqybCSH6NAGjduHgAm9Iuc9zThTLkXIpO0T/18MxAwXPXRHtt O2OVnxdhjjsa01DrynwUQLDMLys0Ld6dd0vPNrA6yWdSDCjTCrlMDE28qv/azzPV3XSE IinA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:organization:autocrypt :content-language:from:references:cc:to:subject:user-agent :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :date:message-id:dkim-signature; bh=LATllXZlJk+cYDGqNM/88KIOt+R2i5kafJXKmW3NbsE=; fh=91koPP6bbStV+o5q3lqs3X7JbvdK5+1b8zBoaMu4Ay8=; b=h3LbL9nAn3hOMDOe/jOkUXA8ZJM0549qa4HmFaO3XK1MY5vzATpB1Oh/HwZ/+8cATZ i0q8KBrzvDL7+DXx8jlfTvIemZiCYeisUCaqlX0pDh99dpkONZIY2/A5f4mbklw/ALJK /bSwztqBdu0e3O1Wyr2wziV6ebWypKp1YEgihNounyNVwkXmLKDcmrORrus8Jt07j7KM P2nYDIMLlY+uMyT5uekXxqjZWH9Sfka9rttNpbl1zyAk3tU2eOxRyqzvWkOvnd9vo+Ck CqUFwgLqArEcVs3hr5n3YMTH/GoF+3sa5BV9snfsZQl6NnW6JAnmEKxgJzuvK/2w9c7P AH5Q==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=UI8hMjtU; arc=pass (i=1 spf=pass spfdomain=redhat.com dkim=pass dkdomain=redhat.com dmarc=pass fromdomain=redhat.com); spf=pass (google.com: domain of linux-kernel+bounces-150033-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-150033-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id 192-20020a6301c9000000b005cec8ea155bsi1243785pgb.842.2024.04.18.05.07.57 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 18 Apr 2024 05:07:57 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-150033-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=UI8hMjtU; arc=pass (i=1 spf=pass spfdomain=redhat.com dkim=pass dkdomain=redhat.com dmarc=pass fromdomain=redhat.com); spf=pass (google.com: domain of linux-kernel+bounces-150033-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-150033-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.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 sy.mirrors.kernel.org (Postfix) with ESMTPS id 4139FB21105 for ; Thu, 18 Apr 2024 12:01:48 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 2258815FD0C; Thu, 18 Apr 2024 12:00:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="UI8hMjtU" Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7D9D515FCFB for ; Thu, 18 Apr 2024 12:00:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.133.124 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713441607; cv=none; b=EtC/Lb1jymvGBvG8JmZ+P4R1e9WkKEap8B6xCHKrs0+DhNAslVr5WWfwdApKCe6w93CmV/PDPp/PSh229/yTQNW4og4JyG8+CeWxQirmm4mlcuWudEOEa2frIxZcbaQjm5Q9L3yP2W1aXuq4mDsEjKdQYyhEcueN4Zk00qtGNZE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713441607; c=relaxed/simple; bh=WE9ol4jgaud3M9DK782EnS/jdkxysyf0MiewX7tFHyU=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=X3yWmRrPomZtp1FWA8mPy+9I3n8H/MFKErErDfgPURhlpIBF+2dCLq2yzNs7oYdhNna4jEE89ZOrer7IlHaCMsWBxX9m39CsKx0u9LAlbmPeWKcm3KmNZ15uVrT+2HupSMqKu8/Fygl1bPcv4otQPB0tccxWcu/2XU63PrSi+Rk= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=UI8hMjtU; arc=none smtp.client-ip=170.10.133.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1713441603; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:autocrypt:autocrypt; bh=LATllXZlJk+cYDGqNM/88KIOt+R2i5kafJXKmW3NbsE=; b=UI8hMjtU53U9j5QftDi9Gf0ezvhi/CGc1PXdThTtgrOcEkDVHQ4oU8+POto0Etm/CEGUB0 HYm+UzlLFwPOqNvLGqVMkiXw80m4hG6xwm8RPMeUGcD5+7vQ1fFUEnT2pWMTHD50K7uu3w TxDgPmA0jHxotKVALlgNF1p4k6UpIu0= Received: from mail-wm1-f72.google.com (mail-wm1-f72.google.com [209.85.128.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-78-gUr5mN-dO8ijxeBXqtsF-Q-1; Thu, 18 Apr 2024 08:00:01 -0400 X-MC-Unique: gUr5mN-dO8ijxeBXqtsF-Q-1 Received: by mail-wm1-f72.google.com with SMTP id 5b1f17b1804b1-41485831b2dso6629745e9.3 for ; Thu, 18 Apr 2024 05:00:01 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1713441600; x=1714046400; h=content-transfer-encoding:in-reply-to:organization:autocrypt :content-language:from:references:cc:to:subject:user-agent :mime-version:date:message-id:x-gm-message-state:from:to:cc:subject :date:message-id:reply-to; bh=LATllXZlJk+cYDGqNM/88KIOt+R2i5kafJXKmW3NbsE=; b=IRG9thHnj2nAXh7Sni595YgM73IhmK+An/HMdD2ivRS9zafEN4lfSbqX7IwV/rwl1B tTUzgVXA0GVKOFmQb9hlfOGNBGd+l+svKL87uZZcE+MIpY806xGvmYMF6zNoVwy0Vrxe QidHIuhlyU2TjTKgj8zYRVPRZwF82gPaC2W2WwwCL9IuNbur2BRoFWYqi3YnBTDMpUYw Yoazb+wb+IACAwOmiYrsL3jLWUExuMRjv7t2r1yJ0sxhJhA1DCALzEddGcqI7aIA5JYj dY90WoJaBtdwMKWZqJwd9wN5xi6z7KZfHiyDNLdBSJsVSYS4HInA0/C0pPn/ZemJnU/V 5eFw== X-Forwarded-Encrypted: i=1; AJvYcCUt5EvxaAZDkE58I6EuBsHGJP8glBo/f4BrVzQbKSRiH3+XVfgh5JiX7N2itiRVI69+uQSZRejiJuP0xHElkxJFnomvWMC9LV8gNw9y X-Gm-Message-State: AOJu0YzSoV/QXZmvum9LzYfxqGI0qp3MkgHwbNmGl2U6FQNKFmRmLU4G t6moIVEFDzFPL0ZZ3O+0ToKc0XmTkhIc7kKpRfG3UHzHt59YRp0KQD87NRrcnNCWoNnOtmgMFy1 rT0birfP5HY2TkaCKRthWtZwiRD/+at7+4fv9iz2GdXN2qDpUmaOaC2YmwvJ6KA== X-Received: by 2002:a05:600c:354d:b0:418:f1d7:7029 with SMTP id i13-20020a05600c354d00b00418f1d77029mr713910wmq.6.1713441600519; Thu, 18 Apr 2024 05:00:00 -0700 (PDT) X-Received: by 2002:a05:600c:354d:b0:418:f1d7:7029 with SMTP id i13-20020a05600c354d00b00418f1d77029mr713887wmq.6.1713441600121; Thu, 18 Apr 2024 05:00:00 -0700 (PDT) Received: from ?IPV6:2a09:80c0:192:0:5dac:bf3d:c41:c3e7? ([2a09:80c0:192:0:5dac:bf3d:c41:c3e7]) by smtp.gmail.com with ESMTPSA id fl7-20020a05600c0b8700b00418ed02cd58sm1387257wmb.3.2024.04.18.04.59.59 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 18 Apr 2024 04:59:59 -0700 (PDT) Message-ID: Date: Thu, 18 Apr 2024 13:59:58 +0200 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v9 3/4] mm/memory: add any_dirty optional pointer to folio_pte_batch() To: Lance Yang , akpm@linux-foundation.org Cc: ryan.roberts@arm.com, 21cnbao@gmail.com, mhocko@suse.com, fengwei.yin@intel.com, zokeefe@google.com, shy828301@gmail.com, xiehuan09@gmail.com, wangkefeng.wang@huawei.com, songmuchun@bytedance.com, peterx@redhat.com, minchan@kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org References: <20240418105750.98866-1-ioworker0@gmail.com> <20240418105750.98866-4-ioworker0@gmail.com> From: David Hildenbrand Content-Language: en-US Autocrypt: addr=david@redhat.com; keydata= xsFNBFXLn5EBEAC+zYvAFJxCBY9Tr1xZgcESmxVNI/0ffzE/ZQOiHJl6mGkmA1R7/uUpiCjJ dBrn+lhhOYjjNefFQou6478faXE6o2AhmebqT4KiQoUQFV4R7y1KMEKoSyy8hQaK1umALTdL QZLQMzNE74ap+GDK0wnacPQFpcG1AE9RMq3aeErY5tujekBS32jfC/7AnH7I0v1v1TbbK3Gp XNeiN4QroO+5qaSr0ID2sz5jtBLRb15RMre27E1ImpaIv2Jw8NJgW0k/D1RyKCwaTsgRdwuK Kx/Y91XuSBdz0uOyU/S8kM1+ag0wvsGlpBVxRR/x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QDv0fFJOA9ag5O3LLNk+3x3q7e0uo06XMaY7UHS341ozXUUI7wC7iKfoUTv03iO9El5f XpNMx/YrIMduZ2+nd9Di7o5+KIwlb2mAB9sTNHdMrXesX8eBL6T9b+MZJk+mZuPxKNVfEQMQ a5SxUEADIPQTPNvBewdeI80yeOCrN+Zzwy/Mrx9EPeu59Y5vSJOx/z6OUImD/GhX7Xvkt3kq Er5KTrJz3++B6SH9pum9PuoE/k+nntJkNMmQpR4MCBaV/J9gIOPGodDKnjdng+mXliF3Ptu6 3oxc2RCyGzTlxyMwuc2U5Q7KtUNTdDe8T0uE+9b8BLMVQDDfJjqY0VVqSUwImzTDLX9S4g/8 kC4HRcclk8hpyhY2jKGluZO0awwTIMgVEzmTyBphDg/Gx7dZU1Xf8HFuE+UZ5UDHDTnwgv7E th6RC9+WrhDNspZ9fJjKWRbveQgUFCpe1sa77LAw+XFrKmBHXp9ZVIe90RMe2tRL06BGiRZr jPrnvUsUUsjRoRNJjKKA/REq+sAnhkNPPZ/NNMjaZ5b8Tovi8C0tmxiCHaQYqj7G2rgnT0kt WNyWQQ== Organization: Red Hat In-Reply-To: <20240418105750.98866-4-ioworker0@gmail.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit On 18.04.24 12:57, Lance Yang wrote: > This commit adds the any_dirty pointer as an optional parameter to > folio_pte_batch() function. By using both the any_young and any_dirty pointers, > madvise_free can make smarter decisions about whether to clear the PTEs when > marking large folios as lazyfree. > > Suggested-by: David Hildenbrand > Signed-off-by: Lance Yang > --- > mm/internal.h | 12 ++++++++++-- > mm/madvise.c | 19 ++++++++++++++----- > mm/memory.c | 4 ++-- > 3 files changed, 26 insertions(+), 9 deletions(-) > > diff --git a/mm/internal.h b/mm/internal.h > index c6483f73ec13..daa59cef85d7 100644 > --- a/mm/internal.h > +++ b/mm/internal.h > @@ -134,6 +134,8 @@ static inline pte_t __pte_batch_clear_ignored(pte_t pte, fpb_t flags) > * first one is writable. > * @any_young: Optional pointer to indicate whether any entry except the > * first one is young. > + * @any_dirty: Optional pointer to indicate whether any entry except the > + * first one is dirty. > * I was also wondering if we should make that function return a pte+nr_pages, instead of only nr_pages, and then simply have the function, based on new flags, merge data into the original PTE. But let's do that separately. Acked-by: David Hildenbrand -- Cheers, David / dhildenb