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 8FB58C83F1A for ; Fri, 11 Jul 2025 11:16:14 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 1F6136B0093; Fri, 11 Jul 2025 07:16:14 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 1CDAE6B0099; Fri, 11 Jul 2025 07:16:14 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 0BCB06B00A0; Fri, 11 Jul 2025 07:16:14 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id F14E56B0093 for ; Fri, 11 Jul 2025 07:16:13 -0400 (EDT) Received: from smtpin13.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id BEEC280732 for ; Fri, 11 Jul 2025 11:16:13 +0000 (UTC) X-FDA: 83651729826.13.D7B4114 Received: from mail-pg1-f176.google.com (mail-pg1-f176.google.com [209.85.215.176]) by imf10.hostedemail.com (Postfix) with ESMTP id DC020C0010 for ; Fri, 11 Jul 2025 11:16:11 +0000 (UTC) Authentication-Results: imf10.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=eaBroRot; spf=pass (imf10.hostedemail.com: domain of lianux.mm@gmail.com designates 209.85.215.176 as permitted sender) smtp.mailfrom=lianux.mm@gmail.com; dmarc=pass (policy=none) header.from=gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1752232571; a=rsa-sha256; cv=none; b=WF+yUix3/IykRbCGUWCapXdFDNn+8CdPMJ5BmOQxdb/d/gV6CyGoAIQgX/fJ7qV5ZglB2C ISWZLfvYW5I5NLMUv3Zxpm9H5BDRu9b9ebe12ydGgpqRlsazzydLURZp3bZV0rqPvWb4O/ YNLzng/T6Nasyn8ZdqJg5e769eK3pE4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1752232571; 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-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=BOujZ1TBTtbU8PPw3UDfxP7MnvO42++mvjjyH+W4bWI=; b=FSbbRrua0LTSp5wQcWpxxHQTm4YharSc58Zp4RX8zccPgacunpcTTNVb9WBYo0kS4x57MT I3kXj9kmhkDqpEaRulM5RqWDPkURHta55MuXOKeov42jR+zQr9T0WAOZTyvXYH7LeQSmtd gIkYmLvFRdeLyWSRflBKu5w985uaMig= ARC-Authentication-Results: i=1; imf10.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=eaBroRot; spf=pass (imf10.hostedemail.com: domain of lianux.mm@gmail.com designates 209.85.215.176 as permitted sender) smtp.mailfrom=lianux.mm@gmail.com; dmarc=pass (policy=none) header.from=gmail.com Received: by mail-pg1-f176.google.com with SMTP id 41be03b00d2f7-879d2e419b9so1543539a12.2 for ; Fri, 11 Jul 2025 04:16:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1752232571; x=1752837371; 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=BOujZ1TBTtbU8PPw3UDfxP7MnvO42++mvjjyH+W4bWI=; b=eaBroRotPErbBDcfDEUVNsKb+d1iBBHm8rnBDqt6dpNcz/EqUNx3OCU0263akVjEzm koHdCjt63fFeUp5nK9tWQ5w6gvXmUZ4x8u7f4/sL6tPT57aaVSmBJJJn0/o84hqoHJ9E xfOYCByyzThTRd0w1fQGSqdADsIIdVlNKWLR4Z03Ey5VVPxNNAdloslJBC1ODuFo2WlU mw4Ap23t7yEe+8jz/aWiw219WrAshbdHpK2hgKcAsdnNdeqfd3h4BaDVgfkdSVuZ5nwN 2SfhHrNlruhd0QsY+Pjo4bsNgBjcEE4HM0wAIO4wgpipaNtWyjugYeQXWqdN4ve8pump EjbQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1752232571; x=1752837371; 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=BOujZ1TBTtbU8PPw3UDfxP7MnvO42++mvjjyH+W4bWI=; b=aDHfGewISPgbQJarL79pPpkyklDJLWIJzKj1xRdkLHCxrpnX79h/jU4EjcDucUZpb3 05ODyjXq68Qrs3yC7Hhb6mP/GuC9x77UjybHhWNpWRKEhpn3Y9gKhCFvepKjeExEwlLe HWccTiup2KCMsJ9PeKwpYxQYWPcCP7RemW3gnOKg5p8H/Wh1SpyNvcHpU7toF9zMRyNL N/SZzR1tbVHrzH4rwllzBSpNHnabxbpRg1rUES3ZWb6zD0rUrt0RReS1t54ZPspKWW9X NYonYEZZyAm7BLPlRMPS9FkaFnlC3+tzTJbAgxio2FYp7KrgYiccBxdYCSx99udXyxm+ QEyw== X-Forwarded-Encrypted: i=1; AJvYcCV6uEClRbS6+PEKjsAtQyM9dUu2wtaNL53JhNhWK8niVblSsneVb8xmuo0UvVI5ecQFf49xhvyktQ==@kvack.org X-Gm-Message-State: AOJu0Yxp9BW4ORpDiHRSqkgyMmKiJgnRmndldKhk+rgNP2PS6G+NqooB 6CFvZd1pA2ZU7RBCaEjD/4b7wetv/K4W1C9PFyKBSf41yulF911xC3Je X-Gm-Gg: ASbGnct7oDm5jvQpRtDZdkL8Qqfi/FrpX20zQN+Mo0UzTTsy8SxpOdQh0wJ84WwbfR+ MHbZlahq0icFavzKJB7iGdMIFPL9T1j2BkA+aptaTrpM7Z6nq0B5zP8ljeOMFKn2MNBXiYk0RUY ED7/72kz1prph3cSmncpph2mocO8xesfkX1LD2ud9FV7rMtejumtnJ327OZPmxJrZa0Ce7KkZ0N jN5i7ii48swI4QfhQj6Hre2xcpZnoZoHduv7LsmaVt8nXyvnBWfkXuZQxzpN9Av898zmx13j+Bj 6P4nySVrxaH2AGMFTFCzS54k4VlDbjpZj5DV02BK5LA80DfOuCbETcEKp/LKF2Hm3wxUeQx6lKl 8W3oHKwy3T7m1iUPMKx6xlV88hDWiqP2F9mpRs6bEnH7E X-Google-Smtp-Source: AGHT+IEIQG7QEB6ft6cUjxp2hKorQ78Cb8O+7jrU7uXwwdEDusnirPFcWyMCbcvxbZFzM8Ph5R1kJQ== X-Received: by 2002:a17:90a:f945:b0:313:d79d:87eb with SMTP id 98e67ed59e1d1-31c4cdb9f31mr4056051a91.35.1752232570365; Fri, 11 Jul 2025 04:16:10 -0700 (PDT) Received: from DESKTOP-GIED850.localdomain ([114.247.113.178]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-31c3e972298sm5133942a91.11.2025.07.11.04.16.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 11 Jul 2025 04:16:09 -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 19:16:00 +0800 Message-ID: <20250711111600.3989-1-lianux.mm@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <81f9a104-6d7d-4552-851e-8690d4a1b723@lucifer.local> References: <81f9a104-6d7d-4552-851e-8690d4a1b723@lucifer.local> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Rspam-User: X-Rspamd-Server: rspam05 X-Rspamd-Queue-Id: DC020C0010 X-Stat-Signature: hij7wr4q5hxqu7kumef5fa4964nfx61i X-HE-Tag: 1752232571-916116 X-HE-Meta: U2FsdGVkX18ucps/Vu0sXU/x2Ke+tCTGZejF3Enh9AG4W2cdPUZnN8chiyOGcoL19milXF/kpSRbs0wUbql4LGuwTqGhY8qkmYv/omFtZF1eELit9+G1tO5lpc/MHGnpeE/zFkcUjmSivGfstgAeQQKNWz934NTdp26VeoGL0XbTPVUWyxHKMoRxVvq0T84EPUAC7ci4KDKo+u24/Li9Q63pF8FkPIaANTZ0XjcMTF/cVy7wIMmgC3BvvDP6+NAPUzrwGeGLTS/UhsumhnLCqNbKKKB9O86rvFnqeQad6IqRzZGDxjjCrrhaepdibSLyWkad41gDSarMVFo/fcSCzzzMm+NfAawW0WaaPovKshBGe4xGlm6lmen7yTZSx/tBxjH0GfH1sUEx+h+Iroegfi4cR7zko2890cfxyx8WvmPDm50zVivlmItmzdrvue3uvCJEEbQiU0rCUleZWpahThEMlr7b9Lpm6QjXxVi1YvuVCkk+GObvhoUfmEzDgg5PQTClRcnfo62WcxarAECCQz2DZfM2e8nfFnZR6bBuOMxixhs0/arDF5eJd4676BaDkcWqpA0DEM6DoRSKdFG4+eyPRhcXw8LIkDgiJuHGkDqnUhMTgRFUaPADGRKdJTWKAhU2d3yTSSSSLs47FyqbFOdsmktuceBIrHelI1jGkBJUDsbgAVPMTXOFBAbU50441m0Iub1uvbiyT2kywIHJgeMnLGW8eVYjVLH4zIG3YrwOt5GRBXzHwXzoF2ZY9/G/r+mgOeh04FyiScsFAQ7+5RQE2yJgeFmjSMGimYtb2j4jZ4eJ9hNUW0DSgKTzGWDzYwnRJGOcjj16j8u+Y7nA+jyhtjBNL18rW9K6AvO4Clnx/XQw+ai5NKkn+USPzYonu2KPwHe16ju79o4Bp1Y4o5h0YEWQelkA0fJSNSRAst1RBRNcW9phpHAHXCsSK9sBEgp4xZCb8NvgVFWkHy1 IWwXYfLD FpbfewvCrlFpmUe0TgbXn2V9y6sn8qvgv+az56TDDDk8CRq2AJis7pwyJ+ERt3lAqxGjP0SvbZ1o6D7fKPPzfl2OauBfYkvzCs61xmJan9kiLT3tCZp0/isZbNMZVxIomyihYp/6IXcRwfXI2HF/wD/uXWSTWJK37ztrStvd91rG8DkO4l2zPi13F9NvCuHjrug9sLN3U090zQ3IrNwG0P+VoRcvkeQMKCYSi9+gCIeZUHVMD7PB0XeNqaiZqQ36+av3MkDrH9AB0SMaGpuAtfbGBzPqkHXD8CX0vabBKwUHtd5kiCpq6GgqYH1OgCqj0/rnwzYYkz2VfacAo3Ih6aQ5jl/PlJzXQtWsVSQBVrw1tJzEy1eqKUrKq7iqpt/FInM33GNItYt6u/hPdHHvw7ap2ODIM2aR3GJVkwOpuAU5oA8o1ylgD53kZCwgT3cfvHW2Zsa6TN+uvExrKNnM8cm7Y9AwqiES1riUZVpLlaGIUmjZmye7AoRnnHZiWR1+oGVfsM6B3JcE6vTmpx1TA5sDoYFrpik0ikS7x 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, >> + * >> + * 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. Best regards, Wang Lian