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 7D4D3C8303C for ; Fri, 11 Jul 2025 12:02:55 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 224E46B00A0; Fri, 11 Jul 2025 08:02:55 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 1FC1E6B00A1; Fri, 11 Jul 2025 08:02:55 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 1390D6B00A2; Fri, 11 Jul 2025 08:02:55 -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 05E806B00A0 for ; Fri, 11 Jul 2025 08:02:55 -0400 (EDT) Received: from smtpin22.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id C4D0A5C435 for ; Fri, 11 Jul 2025 12:02:54 +0000 (UTC) X-FDA: 83651847468.22.84FA780 Received: from mail-pl1-f176.google.com (mail-pl1-f176.google.com [209.85.214.176]) by imf11.hostedemail.com (Postfix) with ESMTP id D54E440002 for ; Fri, 11 Jul 2025 12:02:52 +0000 (UTC) Authentication-Results: imf11.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=fI6RSMwk; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf11.hostedemail.com: domain of lianux.mm@gmail.com designates 209.85.214.176 as permitted sender) smtp.mailfrom=lianux.mm@gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1752235372; 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=XsFF2I3r2LyLT3Mlh+lSG2S5J1f1unVaVJkKRBrcwWE=; b=UuU5UVSUozwyLF0ihk/mZYHUiXCXqYPocIHVBrU+FLTxALju4TDBHpmoBaUPcf1+LxhhNd uWiT1+A+/IPUsmtH/4rGIkSuKysHzaM85yqeB7Aya9+dW/mSBn7qj+NwH+N03D0AGF+elJ nP4YqujtI8PhBvQcOXOQF5waMnrTGEw= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1752235372; a=rsa-sha256; cv=none; b=r4vwyj5d3ZMhgYROHJAePppm6GhReX//AxOOXJmKG3TFmFNs6/muBraKqLPyVXq0jbPzI2 aaIyN3A26EwZP9ftPKLX0aIFTGGSW2iTAB55WarBmAddO8XH/hgtP4VCZWtBYEA70hLewA vurDESLLBMiRHGQYIw+AtgaPxW0aGi4= ARC-Authentication-Results: i=1; imf11.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=fI6RSMwk; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf11.hostedemail.com: domain of lianux.mm@gmail.com designates 209.85.214.176 as permitted sender) smtp.mailfrom=lianux.mm@gmail.com Received: by mail-pl1-f176.google.com with SMTP id d9443c01a7336-2352400344aso18639465ad.2 for ; Fri, 11 Jul 2025 05:02:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1752235371; x=1752840171; darn=kvack.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=XsFF2I3r2LyLT3Mlh+lSG2S5J1f1unVaVJkKRBrcwWE=; b=fI6RSMwkIRvS5gk9OGXsGCjAK+/FfOmXxFS7u2+5i7R5b4IPs+H3q4zlA+yDb1CxLN wzP1wuGYozpuT8Sb31qUJhWApTjJ97GNC5owyqQCoIGoO6Tq28pbqujEFtbwgfJ/0vU/ S7ud1xSpxOcnatl5CKxX92X2n9WNhlNxfki5j0V9pQfyCfhv8rL/2VuPmRG2C40w4f/W gvYEAjF2uNIQZHI7w9ysstkO0bOK1p60GgztmW1M9kCOYT08HIw9JuMb9ejG39C/EPLi NBLl+/LRgn5Kyx2sWcUWjgjC83hf1pZHLYNi6+u0Xcqhi9MmkeZ7sJk+9JsS/0rBmvho N2fA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1752235371; x=1752840171; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=XsFF2I3r2LyLT3Mlh+lSG2S5J1f1unVaVJkKRBrcwWE=; b=QD1FfRBlpADTBU3IHbL6ACDdHzTc3eE6TaHrBc0DOD9O5pkiJHrB1F/jD7DBz7oQ0r lzMHwI0NjrGBMLCW8f1Fu3gkpolXPjUGyBvWYnQxnoA6yglh2G5kJLRVLQZCXR2LbowD XtsuwhRVS8XXzIdTAMYYkEh4Su9pBb15djHYW/u6wd3Sx+Q4cCfc78B8/EaK3Jz+Iwrj q1J41VVZ7AAxkrj4lYmCdEHWpweRpl/etJF9FfLJ3zd9eqRtAZrXTSB/zD5zz0kgpSlv 7qZtA7fL0HKwHkTPdNoZqZO3/+ITfqL5w2bomSeFTQS1O3+9iMq/RQ2blDQLayca867w +p7Q== X-Forwarded-Encrypted: i=1; AJvYcCUa7FuYJQn1KcAmtchfbYFex2BDMoosQWYfb2cfw9QzAgr1/FgJM8CVsEtzJF6otXQNDGfa3nDv+w==@kvack.org X-Gm-Message-State: AOJu0YzqyLPnu2xtBsTq/5RAQZN+IIu3AuEKxPIUNx+FncOwGJNboGdL P2Dh8vmv7ZK0cbUQsS7FHKipM67hz8yo1HCunANoBgHoQoKu3Ox+R5vn X-Gm-Gg: ASbGncs1gilfw+q6nIkrn66LRWcogmrrzWhfGY6nFFDCGXBlSXlAsXKRFeblsXYGDpJ fLsYsIIK7DXmodGGvjRBATVVyNwqqqFPGIDxUVYgqOKoaXbc8W454QIWmDsgGVHZaD2+skcgGoM ulik/o7KS1UWWSb3PW0T1dtoErCEEwXkitMw2RmEu/Gw2yVXmvu/mlpA6mlUWVvruW+FLWes7ya WA+EFNjgs6FWAcBHRsF6s5qZy1JQZPoFAlU7V6SphPr/3GzDTuyRZ1W1ko/eJ90cXZix5G9vZEE b+6UW6a3L+8Mpdjputa3aaq+YEM83QaMSn3vchMmYCCnRPnfDnUPwg8n6UawdvQG91aQMfJhbwX NoEetgHycilbCyJBNEMpSRvhhviGfoqF722jGu1K3uHwyGDeG7kbif5U= X-Google-Smtp-Source: AGHT+IFYWQ/ZoNjvtPKzQLCzn9YTVSOIlm6UJwjlTwkSQUC7rk/srKvasjhL4LUz8bqQlLKaz/2kWg== X-Received: by 2002:a17:90b:4c0d:b0:315:af43:12ee with SMTP id 98e67ed59e1d1-31c50e1763cmr2463122a91.16.1752235371389; Fri, 11 Jul 2025 05:02:51 -0700 (PDT) Received: from DESKTOP-GIED850.localdomain ([114.247.113.178]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-31c3e978c75sm5660371a91.19.2025.07.11.05.02.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 11 Jul 2025 05:02:50 -0700 (PDT) From: wang lian To: lorenzo.stoakes@oracle.com Cc: Liam.Howlett@oracle.com, akpm@linux-foundation.org, brauner@kernel.org, broonie@kernel.org, david@redhat.com, gkwang@linx-info.com, jannh@google.com, lianux.mm@gmail.com, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, linux-mm@kvack.org, p1ucky0923@gmail.com, ryncsn@gmail.com, shuah@kernel.org, sj@kernel.org, vbabka@suse.cz, zijing.zhang@proton.me, ziy@nvidia.com Subject: Re: [PATCH v4] selftests/mm: add process_madvise() tests Date: Fri, 11 Jul 2025 20:02:00 +0800 Message-ID: <20250711120232.13452-1-lianux.mm@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: References: MIME-Version: 1.0 Content-Type: text/plain; charset=yes Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: D54E440002 X-Stat-Signature: 7uq7w9ioeitf7adjduptrzwzan9d7aw4 X-Rspam-User: X-Rspamd-Server: rspam06 X-HE-Tag: 1752235372-903937 X-HE-Meta: U2FsdGVkX19GbcUDzy2C/+9cQlyzhMMu4TWzTmaRH5qWZed9jIxpSM+M0KDBZ1i/WkRrnXxk2353vmpCX3Vt7QjqMmriRdSAjB++HZWgI5IdbrAjRzmCYD+KgVA1rY2FqehPZ7OufyvvI/WZWlDzOEt3eAuo8Y5LTFBpklLGVYWFJ6KHmnU+kRoPAXYnrg8RBxflBLU02cCynKAaI5gS3NIdP6O65rm2MvPrOCIi9cN47xbE+fW89hAStkwslOIYQQT4zseG61H0PSiJUnzmJNtmXlZOpSS2kdcNcgZ3mCFffGUs6rkj+DP070dMJo+n1uTTRHcssAjcgVgXpBY7CKd6qM1fwS8o5j6HHELwaqHLH3In+Tq2H90Y0s1WFG6Lv+z8QS3zPJTaifidIZPC6kCY4Yfk6C2dWhgrONB8uCBE05tY8ai+ezx+qXIvNbFme6n9LeByysvBg4/bxXKQUkC2VU4OqY6nAqPQZrVWtLvoyhg+4CJsD2YJcqC6q8uEqlR4EYIPYK3MyD2Ofa1UDdfy4JjALbA0WNsMFOciukeEsyjJS9nrSxZfphHJedPftScpWJX0kEYTKUvfnu4BENT+yKxQf6VhbsMxqXeH1mLffaF550DUY6NWiHJas09ZCeYi35Q/GJ1HBulDCRX2hSYh+vsQ1N//SXyTEl/a8odgK2P9BaJGVqRBlbpdArAHwq+CpJF+mIH/Deu+iW9M7q9y+Giy0RpTdgY1XGQtHr/tE20DJTTHgAHSTTfjFyMOYMnc+ljflzdAyz7HRFpdtvFgOW30e0BOmbd/p9eZpeJuQKlSPNH5g6uB5wv3SCYVrIsITX3PjwpP7DLt7JUJ3v6k+1KHY8p3k4MzpQAAqti1CzIEKfGrBHYlUjjC+fI5rrkATjTbXAms6HlTZF7fnMZLrAqhQGKlHMXcKszXpBad5j2kvfLjBUiZk3r2LRZv83Q4liFU9+MjwCZlIsu 7OR5HYMC tnIBZcWVJehnQ14/eHDwfKA70HXC6Ef/o+MyLzC7vnqs307sp59ehKjATX9MyJ3V4npiMtpiaN7HOLbAbuxv6YtUbHfNzpEe+i73ZI23Jtam5YtFc8KqlJ3wchqvU2nsTDgZ828B3HQlKpDLxSRi1KyssHWXLmpN94y1Lua0Y2aZt3qGqH+CEwR5BBEj5mYzbo9sWLRRpRH0qCPrbN9GPeyZOhidNmBfa2x1X4Bq8EOshDYykGtLCAhIdh1YT+gPPheNsajb+VrO1bvl28x039leXJcir8QJUlpgi6RfHOp1Re8S3+XQzc+AZDu678RLExEUeDmYIPCfZcDgJ+Od+XsrEy4GM/55vEB4ZSFbHonkG205rwBGmCzy+SnSZE351HXubEQiFKWU4m00z1r4qa8chNxA9iH2Hhx4zwBEQpooZawdb3EXI3/EG50XDzHXx3FMjjMIeqogJ+CBCFqOFJy0Y9YVBkzI4hCiOV2rsrYx1rjvvqShuvpQQGJrv7j0FV6HK6VKX+0QxrseCQTvMtqAX6U8cKHImgKzwwimZwxxgOIAitcX+abKbZvk4k8HpOsAH 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: Hi Lorenzo Stoakes, > > Hi Lorenzo Stoakes, > > > > >> + * > > >> + * This test deterministically validates process_madvise() with MADV_COLLAPSE > > >> + * on a remote process, other advices are difficult to verify reliably. > > >> + * > > >> + * The test verifies that a memory region in a child process, initially > > >> + * backed by small pages, can be collapsed into a Transparent Huge Page by a > > >> + * request from the parent. The result is verified by parsing the child's > > >> + * /proc//smaps file. > > >> + */ > > > > > This is clever and you've put a lot of effort in, but this just seems > > > absolutely prone to flaking and you're essentially testing something that's > > > highly automated. > > > > > I think you're also going way outside of the realms of testing > > > process_madvise() and are getting into testing essentially MADV_COLLAPSE > > > here. > > > > > > We have to try to keep the test specific to what it is you're testing - > > > which is process_madvise() itself. > > > > > So for me, and I realise you've put a ton of work into this and I'm really > > > sorry to say it, I think you should drop this specific test. > > > > > For me simply testing the remote MADV_DONTNEED is enough. > > > > My motivation for this complex test came from the need to verify that > > the process_madvise operation was actually successful. Without checking > > the outcome, the test would only validate that the syscall returns the > > correct number of bytes, not that the advice truly took effect on the > > target process's memory. > > > > For remote calls, process_madvise is intentionally limited to > > non-destructive advice: MADV_COLD, MADV_PAGEOUT, MADV_WILLNEED, > > and MADV_COLLAPSE. However, verifying the effects of COLD, PAGEOUT, > > and WILLNEED is very difficult to do reliably in a selftest. This left > > MADV_COLLAPSE as what seemed to be the only verifiable option. > > > > But, as you correctly pointed out, MADV_COLLAPSE is too dependent on > > the system's THP state and prone to races with khugepaged. This is the > > very issue I tried to work around in v4 after the v3 test failures. > > So I think this test is necessary. > > As for your other opinions, I completely agree. > MADV_COLLAPSE is not a reliable test and we're going to end up with flakes. The > implementation as-is is unreliable, and I"m not sure there's any way to make it > not-unreliable. > This is especially true as we change THP behaviour over time. I don't want to > see failed test reports because of this. > I think it might be best to simply assert that the operation succesfully > completes without checking whether it actually executes the requested task - it > would render this functionality completely broken if it were not to actually do > what was requested. > > > > > > > > Best regards, > > Wang Lian Thank you for the clarification. You've convinced me. Your suggestion provides a much cleaner path forward. It allows the test to focus on the process_madvise syscall's interface—asserting the successful return—without the flakiness of verifying side-effects that are difficult to observe reliably. This makes the test much more robust. I will update the patch to implement this clear assertion logic. Thank you for guiding me to this better solution. Best regards, Wang Lian