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 38D6AC54F30 for ; Tue, 27 May 2025 11:31:56 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 97E9B6B0082; Tue, 27 May 2025 07:31:55 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 92F526B0083; Tue, 27 May 2025 07:31:55 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 81E086B0085; Tue, 27 May 2025 07:31:55 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id 655336B0082 for ; Tue, 27 May 2025 07:31:55 -0400 (EDT) Received: from smtpin16.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id DB68EE83B8 for ; Tue, 27 May 2025 11:31:54 +0000 (UTC) X-FDA: 83488473348.16.7C3B08D Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by imf30.hostedemail.com (Postfix) with ESMTP id 355FE8000C for ; Tue, 27 May 2025 11:31:52 +0000 (UTC) Authentication-Results: imf30.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=eiqBHsSP; spf=pass (imf30.hostedemail.com: domain of david@redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=david@redhat.com; dmarc=pass (policy=quarantine) header.from=redhat.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1748345512; 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=Z9qYdbub9zUvRGRq+I38BqTh9TlHv4cEMEXu3tSNd3k=; b=heM8SXpVCZsBs9aB/T5rB6wCf5cx8wRa8Uq15LDKhMAP+MaW9faZUCELP9v4HXLmFSLOS7 E2p+6ikx+yG1vOD/bq9RuTIE8QVESwlh5lIsUMklVhEuvdoyipqvqsvmv+T4j6ZfS/ZjBo z3Bex0oMj10/Ufu4pD76G8U2BwJtK8Q= ARC-Authentication-Results: i=1; imf30.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=eiqBHsSP; spf=pass (imf30.hostedemail.com: domain of david@redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=david@redhat.com; dmarc=pass (policy=quarantine) header.from=redhat.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1748345512; a=rsa-sha256; cv=none; b=UBohmwzL7yootwH8nsYC2ZoT7FwlzbvioLMsYSeAZRB9Ggj74Ae6UFkU6LifOFrx1KDRg7 Gnv0QyoIqzVMeL/Dvcy62eN7kxwRanopScjCvttjdg/bVPVP5+vJZlWXlftgX59uZ9Vmhf EkItiOeZcp0vUNh4ovR1JnAvnmgnotA= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1748345511; 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=Z9qYdbub9zUvRGRq+I38BqTh9TlHv4cEMEXu3tSNd3k=; b=eiqBHsSP1E2aAhMgUVzrj8PMvSCoNeDRY+OOvv/jt6FqsabbIO6DzoO+FLTSmreMp4sJdY 72uvDORAWbar8Ybot9gRM39tqPQOEnQqSHg26owvnGtXfOlxiVdiUbskssz2SzOwjhwps3 iny0x9h2IZdO5Nn9k4iqiOFxb6rwjUo= Received: from mail-wm1-f69.google.com (mail-wm1-f69.google.com [209.85.128.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-678-uln6PsOMMjO0cbUkY7Fn0Q-1; Tue, 27 May 2025 07:31:50 -0400 X-MC-Unique: uln6PsOMMjO0cbUkY7Fn0Q-1 X-Mimecast-MFC-AGG-ID: uln6PsOMMjO0cbUkY7Fn0Q_1748345509 Received: by mail-wm1-f69.google.com with SMTP id 5b1f17b1804b1-441c96c1977so19110205e9.0 for ; Tue, 27 May 2025 04:31:49 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1748345509; x=1748950309; 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=Z9qYdbub9zUvRGRq+I38BqTh9TlHv4cEMEXu3tSNd3k=; b=T2uwh+8q6hV9ftuLbiR8VU3wpk93H/V+cOwgPXt1sBxOcCuUux6HJObaiRMe+AcWw/ e1a+AZB/M7roq6bPuTVg2cb79p/Ddr7gJHN4pcpkK8ON9Q4bdeJNpgcCHxsHjIjo0K8/ /C66f5eQzHCGSkvr8R+tjvkIJkyigaO98eCBpavYkwLzMoKfmMvyeT871b0HsiVLY0MD C6hMvS2xIiorlETDO+wKg/TX8yN3zs0kqhbI4lkynz770OWvcKaiadWkIXmUEUaftU7a FhyjqzjreU12IdlfpzmvDVuBZNUIjIbh9R7yvehIiUfa33YjszTsdCOCeNSQT65h7fxh GHgQ== X-Forwarded-Encrypted: i=1; AJvYcCXZ3iy2bJPpvqkXbVAAOmmwAd2fB402vUOJI2EKNhMfKKpAXA1Zp9D4K3ztYExsa7Aqc0oE6N67Nw==@kvack.org X-Gm-Message-State: AOJu0Yynemt/bSfFhsdZyqUQFo6SHblH9H+Y7qLR+z3Mke2kKVnl+XYN 2ce5KaT8Yhigzk6TaB31XyTiClUaSVniiFx66X4wnA1sWyT+j65GulIMhe/9poiJaC3P3b7dgjB yGB74WMulIitUpOW8jq0EwqlrF47bSDO7ZG9L461bK4+L3dgQnklVCR0K7lofLGU= X-Gm-Gg: ASbGncu/8v2JWTqM4rinR+A/GxU5XVMcHf8o64gqe5ovyiXNq3vA8yr0oooFkYQHqTJ 86ld4zA+rwvTuFPMnJsWdB4psXN/h5gcT6eFUGfhATzpJh3quFDDWIySnIjsRk6Fbg8TzTrKlC3 OeShGOk11uUMfzYszxl7vsMuHT6UnNyLDmTro0s9TvHAaq3bzFSdoTMEwo0BLgja1KXKU/VQYIw e13IDYlfY+WtPYvnpquQhS6QxU9N91U/a2Lv/Cr10a5rgYwHsqTYYn8uPcl9ifvrnOP+On8Zzzh hoJi5WiBJ7Uu2ihHzu/KBkMshjFOQIGjxG8Av/18d2qA X-Received: by 2002:a05:600c:3b8a:b0:442:f485:6fa4 with SMTP id 5b1f17b1804b1-44c95aad94fmr118089305e9.31.1748345508846; Tue, 27 May 2025 04:31:48 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGjikzCRKO5eGlrWWZyz6px1afcG1oeyTmrMOlflDfZJbS3aoRJDgzo9zBUIvvPehhCSvQC2w== X-Received: by 2002:a05:600c:3b8a:b0:442:f485:6fa4 with SMTP id 5b1f17b1804b1-44c95aad94fmr118089025e9.31.1748345508443; Tue, 27 May 2025 04:31:48 -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 ffacd0b85a97d-3a4c9dd7c27sm10711727f8f.45.2025.05.27.04.31.47 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 27 May 2025 04:31:47 -0700 (PDT) Message-ID: <40dc48f9-94d7-46b0-83ed-d3511789c15a@redhat.com> Date: Tue, 27 May 2025 13:31:47 +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> 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/DdmogJh0gNC0+N42Za9yBRURfIdKSb B3JfpUqcWwE7vUaYrHG1nw54pLUoPG6sAA7Mehl3nd4pZUALHwARAQABzSREYXZpZCBIaWxk ZW5icmFuZCA8ZGF2aWRAcmVka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uE+UZ5UDHDTnwgv7E th6RC9+WrhDNspZ9fJjKWRbveQgUFCpe1sa77LAw+XFrKmBHXp9ZVIe90RMe2tRL06BGiRZr jPrnvUsUUsjRoRNJjKKA/REq+sAnhkNPPZ/NNMjaZ5b8Tovi8C0tmxiCHaQYqj7G2rgnT0kt WNyWQQ== Organization: Red Hat In-Reply-To: <20250527063428.4ykrdtive2hfnqdp@master> X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: _VY1r_tzxYpV8hAOUVy8lZzYfV82CUbNtvIpNzw_lS4_1748345509 X-Mimecast-Originator: redhat.com Content-Language: en-US Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Stat-Signature: khbp9yf68p9i5oodqq3wrem6m3ibircu X-Rspamd-Queue-Id: 355FE8000C X-Rspam-User: X-Rspamd-Server: rspam02 X-HE-Tag: 1748345511-91081 X-HE-Meta: U2FsdGVkX18Lca+RvrKFIlJPaXDGPCXTKd80ucPNmIgjex2B6ugDgk0CxbKyanMTXsOHK3hUBO3Ejy+Zz24UGlALcJYejKUXJhT0bp+RjGoaLcFF0FIw7co9DmVzAHwWE3Xh9FJbHTRrGBG9nEdJUpmkWg5vP3Ls44lZFmLR3K2EZH5AQDxB8ltY6JzyOA49cv2QfLrH67/mIWSC6QpHuCD0UsUHbxIL0x23LBedspb4WHeoXjO5EXEI8rUm0t3Cbg1+NyIyTjEJMrFKO9tNaMtXcVHg8TWGP6sMI4HDTjZ7PglNhLIrd19/EzHBXCQRQ8zjSek4g6/mCTzvSAlZc92dHujwGVfFdyhgzJ5eFFnQ+uMCyw6oFONHKuOM+Sa6yaDExaACTpx919YuXx6kVlMsVfRSHKUU0kOnfuGybnU4xV8mIIM0p8W/FMo5jDc2jZST+8QDcgCv1IbTxWu2TkztrtJOi6abDr61XhGMmYGV7t7lt01HBRDWRAWLowjorOq+4WiIfvYy1xR/zWE3KM0hv5/QvV1VsRiirEuV4dEc+3zWWf2zxJvVzgEqWhTrk2tDTGG3PFUUMdjIiX7mPusI7bcqC7eXyGdrQm0sT5w6QAPH9qldHlEGorUjvckt+8BO41JvkcMkrSica/xpAxXjfwSaZY68d/+QWYXPh62PAuc2G0w3CK5jcgH1Gl21U2neKcwFRcBRiCG7PrB8suiYsgqj2ehOG561NQlDz906SpNnC6ow8aEq/iCV012+PfJkal+MmAA+bZGGVtHHmKQ6Ke5Th/fiYP3Hsik9q2jhuIYEHOKo4l3T4ypL4M+HBlpoS2asgAtDbNcxZwysT2FIUuT51pi3W1hPtNJdhG4SYhxSMxnETfXnRvMBYnkTZp8+sbbslF0ei32aLF3GpXB7Xh1rW/AgQF23d8/A7ErakT8K5e4YERhZv2rkDIh9fS2BRK7AiMqfYDP0rux Sao4R9Dy Y1yKQeQ2pOwHNkd354zVSqz4lhAyimw7HbQCsZAehwOeLaSqXLgg/AV56ymnEC1Vn8+ZsnhVdUbmfIddnpo6ievpaX1uhJ6XRn/W8EA8l704L1fLiOTr2RVM/hVYoNf1pqKoroff4kaiDToqqghdFv+Q8LC8er8xUhifjmaxCGr6fT94UrYeZozn7dScKRoN9WC2XbJYldCsuVi5h+Rz2cyzXpYMtfs56p8NZ7PjorKr+PfY3ldKhRbE/fjFHoHyBcuhG3XFOK5bSOAVy8KaF7yYBRZiL3EpNRaYlnBKvKkqUWahUfGCIBkM1DOg3aUNKmJ0Q7Ww73OMe7loOCFNv0AX0hJE9r/5FJP4w9wGE5NdTLXMMCle35Vc6fmdO/MTAbpIedpmDkm65yvk7ol1HUn80qsNnkDd/EbbpWBA0SoJ37dJMgjPRIJJiQDK4xyQBoYnbKaBIKd0rn4t0Bohr61hwXbkutDYPo9IwUAAjlqCAjgnSDp6CS2JIZ+nsHR0UTSTtAHlcg35JQGySiz5HdaFgUb4A7axTRgDn X-Bogosity: Ham, tests=bogofilter, spamicity=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 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 We could likely do it with anon pages (swap), shmem pages (swap) and pagecache pages (file backed). ... and possibly even with KSM pages! >> >> But we need to enable pageout in this way first. Yes, madvise(MADV_PAGEOUT) needs to be extended to allow forcing a pageout (e.g., a new MADVISE_PAGEOUT_SHARED that only works with with CAP_SYY_ADMIN). >> >> I am not sure why this one is easier way to test. Would you mind sharing more >> idea on this? It might be easier than the migration case, because for migration we currently need 2 NUMA nodes ... >> >>> Some rmap tests could make sense for both, anon and pagecache folios. >>> >>>> >>>> Something like below? >>>> >>>> * fork and migrate a range in child >>>> * fork/unmap in parent and migrate a range in child >>>> >>>> If the operation is successful, then we are good, right? >>> >>> Yes. And one can come up with a bunch of similar rmap test cases, like doing >>> a partial mremap() of a THP, then testing if the rmap walk still works as >>> expected, pairing the whole thing with for etc. >>> >> >> For both way, we could arrange all those scenarios and also do partial >> mremap() during it. Exactly. >> >>> One "problem" here is that even with MPOL_MF_MOVE_ALL, >>> move_pages() will not move a folio if it already resides on the target node. >>> So one always needs two NUMA nodes, which is a bit suboptimal for testing >>> purposes. >>> >>> For testing purposes, it could have been helpful a couple of times already to >>> just have a way of migrating a folio even if it already resides on the >>> expected node. >>> >> >> This looks we need a new flag for it? >> >> Here is my plan if my understanding is correct. >> >> 1. Add test cases for fork + migrate. We may limit it only works on machine >> with 2 NUMA nodes. >> 2. Enable move_pages() on local node, then remove the test limitation >> 3. Enable madvise(MADV_PAGEOUT) with multiple mapping, then add related cases >> 4. Add mremap() or other cases >> >> In general, to verify rmap dose the work correctly, my idea is to >> >> * mmap(MAP_SHARED) >> * write some initial data before fork>> * after fork and migrate, we write some different data to it >> * if each process do see the new data, rmap is good. With pageout (see above) test, we can just verify using /proc/self/pagemap in all processes whether the page was paged out (IOW: the rmap was able to identify all page locations). And that should work with anon/shmem/file/ksm pages IIUC. >> >> Does it sound good to you? Yes, that absolutely goes into the right direction. Having also rmap tests for KSM as raised above might be a real benefit. -- Cheers, David / dhildenb