From mboxrd@z Thu Jan 1 00:00:00 1970 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 5A972C3ABB2 for ; Fri, 30 May 2025 08:00:27 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id D01CE6B0089; Fri, 30 May 2025 04:00:26 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id CB2A36B008A; Fri, 30 May 2025 04:00:26 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id BA10F6B008C; Fri, 30 May 2025 04:00:26 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id 9AF3E6B0089 for ; Fri, 30 May 2025 04:00:26 -0400 (EDT) Received: from smtpin22.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id 34FA182986 for ; Fri, 30 May 2025 08:00:26 +0000 (UTC) X-FDA: 83498826852.22.5D082DF Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by imf08.hostedemail.com (Postfix) with ESMTP id A5AF016000B for ; Fri, 30 May 2025 08:00:23 +0000 (UTC) Authentication-Results: imf08.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=EEsQ0HS1; dmarc=pass (policy=quarantine) header.from=redhat.com; spf=pass (imf08.hostedemail.com: domain of david@redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=david@redhat.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1748592023; h=from:from:sender: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:dkim-signature; bh=VWPfh9Q9DJSwLnmcATdiS0rGZwhl16xN6L2VQSjv9Sk=; b=ff2HMIQsIrlLGzdfg9Pa2oRVouEjgTwPfpaJX5UoE7As57Gj6YISYjys00UxIpvmbdlhAu sWz4i4TzrsUlRKneGOyhRtnmh5qBSH/7inAygCpuxRzhwRwBFSVFh6ODGdcke+2/zPPQbR txC1Ih7+WesZvg6taT5aZvloFNJjJhg= ARC-Authentication-Results: i=1; imf08.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=EEsQ0HS1; dmarc=pass (policy=quarantine) header.from=redhat.com; spf=pass (imf08.hostedemail.com: domain of david@redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=david@redhat.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1748592023; a=rsa-sha256; cv=none; b=oBQ2VdGirS3Ivi5WOFHqZntEhJzWRZScaTBTwfD4VJ8jjs3Wm7t9xZh4sg0XT6kTEsINl1 RtgdpPtmn4AlOTE7Faiflw7G1t4/P0ZPamSGrNo3Ep28TLBxxj7sTLX0hkbOIBmqMpMAvE OHcMVmU1NMPItKoLQL4d8VPp8UBN+UA= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1748592022; 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=VWPfh9Q9DJSwLnmcATdiS0rGZwhl16xN6L2VQSjv9Sk=; b=EEsQ0HS12AlieI90I5zHYf9Y7Cam9apfXp/BFt52/JbfXe9ZIT+fbJRoRiAmI4FaCH8vgG oGf55+cmgKBw+Rbg9QBPIPylPZGxaI9ypcQ7Zdm84/0hTaEfBjaabBKIIHOlAEv6kP1yZ7 RderVza846WPTGrv57sgpGivOeV4DHE= Received: from mail-wr1-f70.google.com (mail-wr1-f70.google.com [209.85.221.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-396-hRSrp3aXNDePngt0CpIuaA-1; Fri, 30 May 2025 04:00:21 -0400 X-MC-Unique: hRSrp3aXNDePngt0CpIuaA-1 X-Mimecast-MFC-AGG-ID: hRSrp3aXNDePngt0CpIuaA_1748592020 Received: by mail-wr1-f70.google.com with SMTP id ffacd0b85a97d-3a4f7ebfd00so252911f8f.2 for ; Fri, 30 May 2025 01:00:21 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1748592020; x=1749196820; 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=VWPfh9Q9DJSwLnmcATdiS0rGZwhl16xN6L2VQSjv9Sk=; b=WojDcJBLbuMbeXI13P3Rf/cVTWGpzHUjYavYK3k96h2pAcxafqsKLk2FZFdLV9Lc1A JA7Ygae5Azn1lwWSJB9zuqy++QSYV1axqhdrQ7+04GYD97KuYwY+e0iBS9sXj0WshR6/ xBFv2nqVuSatUliTTzqzbCZaIxVh8/qHyfnpDlxPwGlRpm/HwDYIcJ8mnM86c6kyhiv+ sZnoJyWkGqkvKk2emtbS6xAUkVV+6DGjZpG9Xgt11uYkTACVtd9jqEDpZ/swbCm8t9ek 7kTmXxyZs8Inh1O4PB0/jyHlUmNPoTn59XZfRS3yLueb1vPYeUiI3cw2SIFNrnrm4/4c Cv4Q== X-Forwarded-Encrypted: i=1; AJvYcCUepoQNSUUE9DbckbhqX+H0J+EN1XSXChe8XC+mZ8zMO17/wh0zznceC+VLzQBfW+3m2GAbI12CJQ==@kvack.org X-Gm-Message-State: AOJu0YzdFBJ1eHkcepznHWApkW1zMqAg86S6g1LQL4AwkrEjnKqensWN OW5b3dk/1cPGdF3gJ/68n34gQb8cc3elsFl4q39meJGXI4vV/VCcxpjUcLq4d400zQz+xAFuTtw RNUeuD+8XGAoxG37sQNHBBi2Rf428x86pYYOGBu0mO7Csv9cZzlsW X-Gm-Gg: ASbGncuFh0e9hMxKqjyS0V7RlQQ/PG226HQ6QG5CEE1OB4hitE0/RP3mP4ttdykvhiv ocdtaEKteMwN0dIShgcnzXpG/md11IVV7DHaMJmQUJnHWvtkAgLrJahaQKlDFduFBiEIq6UHKc0 m2QjIPm/gS48Dh0rf3XJYGyYJe2JT8prH7+W9/OdZFXYx4E9NMoONmqHVEfUm70F1qQgW8xMc8L x9r80ljSMDLhU9wMiK8E1gXy2mAhi1E3utksBOwx4o51ioL02VNFTOEOwWcaIcvlE4GEoiOm0DH Eb9TYvkoy934LlZiJr0B8F0prjQnOMqNCnpR4I1vF1aiBB1oNqj86vrxCpzRapidkogJCz+BdJk g6JHVI4aYKxfXPsb5Tn6KCOdw9z9ewiMhoAO3EIg= X-Received: by 2002:a05:6000:250d:b0:3a4:f50b:ca2 with SMTP id ffacd0b85a97d-3a4f7a3c953mr1516063f8f.8.1748592020184; Fri, 30 May 2025 01:00:20 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFoF2q8oz7v6xYaFVg3WXKmAGPaDNVDECjvzqd8FYRJZIN3SZaRzXYnV10YGcc/nwGs7sERsA== X-Received: by 2002:a05:6000:250d:b0:3a4:f50b:ca2 with SMTP id ffacd0b85a97d-3a4f7a3c953mr1516022f8f.8.1748592019645; Fri, 30 May 2025 01:00:19 -0700 (PDT) Received: from ?IPV6:2003:d8:2f03:5b00:f549:a879:b2d3:73ee? (p200300d82f035b00f549a879b2d373ee.dip0.t-ipconnect.de. [2003:d8:2f03:5b00:f549:a879:b2d3:73ee]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-450d8013405sm10631735e9.38.2025.05.30.01.00.18 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 30 May 2025 01:00:19 -0700 (PDT) Message-ID: Date: Fri, 30 May 2025 10:00:18 +0200 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [RFC Patch 0/5] Make anon_vma operations testable To: Wei Yang Cc: Lorenzo Stoakes , akpm@linux-foundation.org, riel@surriel.com, vbabka@suse.cz, harry.yoo@oracle.com, jannh@google.com, baohua@kernel.org, linux-mm@kvack.org References: <20250429090639.784-1-richard.weiyang@gmail.com> <8c268ece-71a7-470a-bf8b-71d3e4920977@redhat.com> <20250429235608.yvbcxybkfsmp6ow5@master> <20250514012318.2impqotf65p4ihsc@master> <20250527063428.4ykrdtive2hfnqdp@master> <40dc48f9-94d7-46b0-83ed-d3511789c15a@redhat.com> <20250530021112.6b2ldosl3hvhcnvq@master> From: David Hildenbrand Autocrypt: addr=david@redhat.com; keydata= xsFNBFXLn5EBEAC+zYvAFJxCBY9Tr1xZgcESmxVNI/0ffzE/ZQOiHJl6mGkmA1R7/uUpiCjJ dBrn+lhhOYjjNefFQou6478faXE6o2AhmebqT4KiQoUQFV4R7y1KMEKoSyy8hQaK1umALTdL QZLQMzNE74ap+GDK0wnacPQFpcG1AE9RMq3aeErY5tujekBS32jfC/7AnH7I0v1v1TbbK3Gp XNeiN4QroO+5qaSr0ID2sz5jtBLRb15RMre27E1ImpaIv2Jw8NJgW0k/D1RyKCwaTsgRdwuK Kx/Y91XuSBdz0uOyU/S8kM1+ag0wvsGlpBVxRR/xw/E8M7TEwuCZQArqqTCmkG6HGcXFT0V9 PXFNNgV5jXMQRwU0O/ztJIQqsE5LsUomE//bLwzj9IVsaQpKDqW6TAPjcdBDPLHvriq7kGjt WhVhdl0qEYB8lkBEU7V2Yb+SYhmhpDrti9Fq1EsmhiHSkxJcGREoMK/63r9WLZYI3+4W2rAc UucZa4OT27U5ZISjNg3Ev0rxU5UH2/pT4wJCfxwocmqaRr6UYmrtZmND89X0KigoFD/XSeVv jwBRNjPAubK9/k5NoRrYqztM9W6sJqrH8+UWZ1Idd/Dd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GzTlxyMwuc2U5Q7KtUNTdDe8T0uE+9b8BLMVQDDfJjqY0VVqSUwImzTDLX9S4g/8 kC4HRcclk8hpyhY2jKGluZO0awwTIMgVEzmTyBphDg/Gx7dZU1Xf8HFuE+UZ5UDHDTnwgv7E th6RC9+WrhDNspZ9fJjKWRbveQgUFCpe1sa77LAw+XFrKmBHXp9ZVIe90RMe2tRL06BGiRZr jPrnvUsUUsjRoRNJjKKA/REq+sAnhkNPPZ/NNMjaZ5b8Tovi8C0tmxiCHaQYqj7G2rgnT0kt WNyWQQ== Organization: Red Hat In-Reply-To: <20250530021112.6b2ldosl3hvhcnvq@master> X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: a3Kp7bCsS5ngjgQgMNdA8OUVgW9g3esMhzNecqYiohg_1748592020 X-Mimecast-Originator: redhat.com Content-Language: en-US Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Rspamd-Server: rspam05 X-Rspamd-Queue-Id: A5AF016000B X-Stat-Signature: ym4y8nom9zubq18ikpwfbnxhdcgf3wxr X-Rspam-User: X-HE-Tag: 1748592023-243011 X-HE-Meta: U2FsdGVkX18MzKd3bYDrFCnjwgr1IWmCOCsUpPydVKsHs7/rc9hfmGlSmnps8Ri3aTlQLgMDTG4pOo1EKXwa/ZQoRnPGb0wyLOffTkmJ4Id0hTMv3RwRJ0nvQxMlPR5zlnHtXkfUD7DiFN9oDQEiak/cwNng6xQgBhdEWPqxNLX29Yp4Xu7SlpunIodKMXFXwoGxRhIO+HSbDBZPin/vgUYHpKlJV4e/NbmxYjNx+kwZ6bgdodV8reTgJsYWss8yqEqb8qSnezU2lOAiDZM27LXGXcC0ygLB4kBedfI1BBphoi7eyK19jQ14MCINmJpf2Yl+bYXqos0+anv5ua8h3v/9Uv4aDCevLrEU1se2E81xh/oBkbD3KzimY/7uCR+yJCAnQVm2EK2lcDeBowJ8c6RR708frzvCT6rvR8rmBnRLjkY3P/Y61IoIpVDgbg8JSby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amicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: On 30.05.25 04:11, Wei Yang wrote: > On Tue, May 27, 2025 at 01:31:47PM +0200, David Hildenbrand wrote: >> On 27.05.25 08:34, Wei Yang wrote: >>> On Wed, May 14, 2025 at 01:23:18AM +0000, Wei Yang wrote: >>>> On Wed, Apr 30, 2025 at 09:47:16AM +0200, David Hildenbrand wrote: >>>> [...] >>>>>>>> Agreed, skimming over the tests there are some nice diagrams and cases. >>>>>>>> >>>>>>>> But I would hope that for most of these cases we could test on a higher >>>>>>>> level: test our expectations when running real programs that we want to >>>>>>>> check, especially when performing internal changes on how we handle anon >>>>>>>> memory + rmap. >>>>>>>> >>>>>>>> E.g., do fork(), then test if we can successfully perform rmap >>>>>>>> lookups/updates (e.g., migrate folio to a different numa node etc). >>>>>>>> >>>>>>> >>>>>>> That's a great point! Wei - if you could look at making some self-tests >>>>>>> (i.e. that live in tools/testing/selftests/mm) that try to recreate _real_ >>>>>>> scenarios that use the rmap like this and assert correct behaviour there, >>>>>>> that could be a positive way of moving forward with this. >>>>>>> >>>>>> >>> >>> Ping >> >> Thanks for reminding me and sorry for the late reply. >> >>> >>>>>> I am trying to understand what scenarios you want. >>>>> >>>> >>>> Sorry for the late reply, I handled other things a while. >>>> >>>>> That is exactly the task to figure out: how can we actually test our rmap >>>>> implementation from a higher level. The example regarding fork and migration >>>>> is possibly a low-hanging fruit. >>>> >>>> If my understanding is correct, you suggested two high level way: >>>> >>>> 1. fork + migrate (move_pages) >> >> Yes, that should be one way of testing it. We could even get multiple child >> processes into place. >> >>>> >>>>> >>>>> We might already have the functionality to achieve it, *maybe* we'd even want >>>>> some extensions to make it all even easier to test. >>>>> >>>>> For example, MADV_PAGEOUT is refused on folios that are mapped into multiple >>>>> processes. Maybe we'd want the option to *still* page it out, just like >>>>> MPOL_MF_MOVE_ALL allows with CAP_SYS_NICE to *still* migrate a folio that is >>>>> mapped into multiple processes. >>>>> >>>> >>>> 2. madvise(MADV_PAGEOUT) >>>> >>>> Not fully get it here. You mean fork + madvise(MADV_PAGEOUT) + migrate ? >> >> fork + madvise(MADV_PAGEOUT) only. >> >> Then verify, that it was actually paged out. >> >> For example, we could have 10 processes mapping the page, then call >> madvise(MADV_PAGEOUT) from one process. We can verify in all processes if the >> page is actually no longer mapped using /proc/self/pagemap >> > > Hi, David Hi! > > I'd like to clarify some detail here. > >> We could likely do it with anon pages (swap), shmem pages (swap) and >> pagecache pages (file backed). >> > > I could understand the three cases here, but for the (swap) case, it is not > clear to me. You mean we force the page to be swapped out before migration? I > may not have an idea to ensure that. No need to involve migration for that test. It's sufficient to trigger pageout to then check if the page was unmapped in all other processes. > >> ... and possibly even with KSM pages! >> > > For KSM, it looks like an general background routine. I guess you want > something like: > > * fork process tree > * do KSM and wait for it to finish? Probably allocate memory in each process and fill it with the same value. Then wait for KSM to deduplciate. > * migrate Yes, or instead of migrate, trigger pageout from one process, then check if pageout in all other processes (/proc/self/pagemap) > > I guess the KSM duration would related to the total memory on the system. The > bigger, the longer. While the selftest generally have timeout setting. Not > sure it would be suitable for all situation. > > Would you mind sharing more on KSM case? Worth looking at tools/testing/selftests/mm/ksm_functional_tests.c (and the other KSM selftests) In particular, in ksm_merge() we can detect whether KSM completed the scan when two full scans passed. A lot of that functionality could probably be factored out into vm_utils.c to be reused in other tests. -- Cheers, David / dhildenb