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 7BB15C021B8 for ; Wed, 26 Feb 2025 11:52:39 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 0B38128001B; Wed, 26 Feb 2025 06:52:39 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 03BC3280015; Wed, 26 Feb 2025 06:52:38 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id DF77828001B; Wed, 26 Feb 2025 06:52:38 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id C1C87280015 for ; Wed, 26 Feb 2025 06:52:38 -0500 (EST) Received: from smtpin17.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id 6A82AB698C for ; Wed, 26 Feb 2025 11:52:37 +0000 (UTC) X-FDA: 83161933554.17.2B92275 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by imf27.hostedemail.com (Postfix) with ESMTP id D07F740005 for ; Wed, 26 Feb 2025 11:52:34 +0000 (UTC) Authentication-Results: imf27.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=ahTLmZ2h; dmarc=pass (policy=none) header.from=redhat.com; spf=pass (imf27.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=1740570755; a=rsa-sha256; cv=none; b=JjSiuqefMkNl2eCWL5vyTBKDLPxxptouL7OYiAN+dNIa4Wo6UO0ZR64zgR1w2NfQgdarAM OYPQRPS3/Y73OQMSL5fVwnWwmgPRDpDfUMBlHkb0J/nY8diucvycthaMeNQcwn1u1BsjAg +c4W44gSb6cU6UwZ2DxYuc+IZrvin0k= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1740570755; 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=0p71Bc+tSNk19U8eoW67nNiNmqlLTYbFS9i3TH6hlEU=; b=3R8a9/KJ/fdHZtjyT56KDGh1N34xGGVldkg6UsKCWA277MdfsVzE59/jBIBawGxXRUpc0J X+QfwTOFkuwcaAK+G027eN6rwi5gtloxZko4OjuDgiFn+eWC4H9cF2sBcC39/7xPSVHQYD lVylARE2xOBzTA+oRMQDGbJNlMYOlQo= ARC-Authentication-Results: i=1; imf27.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=ahTLmZ2h; dmarc=pass (policy=none) header.from=redhat.com; spf=pass (imf27.hostedemail.com: domain of david@redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=david@redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1740570754; 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=0p71Bc+tSNk19U8eoW67nNiNmqlLTYbFS9i3TH6hlEU=; b=ahTLmZ2hKw5nqPhQEik4b4bnFJZbbqulVoCu2bANMp26FFZJShY2AY9Kpa7zwIP3jQUD3H Z7Hso02Wh9RLUHM0WS71HEKoqlXsWLmFXvz1SDNVC/5ROKkJ1FQBREP4HjBQj4zrJUPYS6 kLxRb3ng6uuKjYAjHx2JBhreVEGKbAk= Received: from mail-wr1-f72.google.com (mail-wr1-f72.google.com [209.85.221.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-674-bxKa_5uFMc-R85DnucfebQ-1; Wed, 26 Feb 2025 06:52:32 -0500 X-MC-Unique: bxKa_5uFMc-R85DnucfebQ-1 X-Mimecast-MFC-AGG-ID: bxKa_5uFMc-R85DnucfebQ_1740570752 Received: by mail-wr1-f72.google.com with SMTP id ffacd0b85a97d-38f4bf0d5faso3514761f8f.0 for ; Wed, 26 Feb 2025 03:52:32 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1740570751; x=1741175551; 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=0p71Bc+tSNk19U8eoW67nNiNmqlLTYbFS9i3TH6hlEU=; b=DAJfDOxnghA2QFcS5OR5mKhqtocq44BosL30H/lWhbTy3IAfrkwoyyrL5gEBwTvfpV PQIckPpL2eFbXqrQWd6m33C9z37wbHNJQhXHCjYo6JC2xYuQq3b6x79AXL9/B96XiPhT z0GtmxVu9D2PWSzoEaDav7VZDlevgDNiTwdycNWVYaU1m/00qeOcvquNGJX2SY6VJI5i XKynz/OAEV10G0J4IHd/ZKTebfGQTwTB7zNfb5PZGXXI3ZW2+05XpHO41FvlZ6Ly4TT+ AVyKQ4RvHyFskFhNSYXoa81IrlOBEfPwEI8lX5DjSR9RFCubj78UNxGi3MPSNNOJ1Lq5 tVqA== X-Forwarded-Encrypted: i=1; AJvYcCVQxN/PacpUinv+Jg9MB6CJT/XmIKrUv7c580+BYqx6KNehvz9pRVh3XaXQ3xqxc+duXEvTlpGYjQ==@kvack.org X-Gm-Message-State: AOJu0YyolanUVMoXnj4/gTtfPXYiHUIHR2zs7DBVPl8Fdk2jzEp8jtLR lBFnoQNuj04RGWNqLzC9QbEL+dYJjdvke7sUu9KPrQFfa2pR+JVNNIapnwNN6v8ocj1PMwXcDd1 miABU3gzUpbjJvzdxnJhRYLjmtNfFbshJMrqk8BSmDgzr2bKA X-Gm-Gg: ASbGncuJKH83PacC1RNcpTtr2glr6/sYWdNL+jjl80FL1yG8uBWmGxT3jar7QoQ5xkP ige+Ofmw0lhV4aEGTaUhjetC+HKjDonQeGKniZbecA+QL4EyCiTLKHeQiBl70SBrcv0txvKCQie ihBobJItCRj8K019/ZEvAwqO0wY1OwApaICO5AGS5Q30XvCHVY016EgP4vmudQKGjsgpNpGrYt5 AlhlnKH1dUtRDg4zHiO/4N8Hxi71yvwQhVeAojcpw9JocC4II4vNC1Lo+UMyp/7ymCDX0lXygZX v4ljQR/FodgaJ+Of/XDBKicwNy5k3mV235L7F2ooKnWbVlyyQVR6g6dKb3FSVfNWb7KfRkM6cR8 JoSi8u6Juf/Ho80JeAs7BvQsnIwa2qpOTAk6ZHw4vr/A= X-Received: by 2002:a05:6000:2a7:b0:38f:4fa6:e641 with SMTP id ffacd0b85a97d-390d4f84740mr3006492f8f.43.1740570751450; Wed, 26 Feb 2025 03:52:31 -0800 (PST) X-Google-Smtp-Source: AGHT+IEw6LTiRCfqsNc3pw3LySJCXKQPJIe6Q8/sql2dmRjbzjqWwsMFFiGxlF1FuddtHIXqDIK76Q== X-Received: by 2002:a05:6000:2a7:b0:38f:4fa6:e641 with SMTP id ffacd0b85a97d-390d4f84740mr3006423f8f.43.1740570751066; Wed, 26 Feb 2025 03:52:31 -0800 (PST) Received: from ?IPV6:2003:cb:c747:ff00:9d85:4afb:a7df:6c45? (p200300cbc747ff009d854afba7df6c45.dip0.t-ipconnect.de. [2003:cb:c747:ff00:9d85:4afb:a7df:6c45]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-390cd86cd10sm5467317f8f.37.2025.02.26.03.52.29 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 26 Feb 2025 03:52:30 -0800 (PST) Message-ID: <657f10ed-4e82-4048-98ab-1c4b65349298@redhat.com> Date: Wed, 26 Feb 2025 12:52:29 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH RFC 0/4] mm: KUnit tests for the page allocator To: Brendan Jackman Cc: Brendan Higgins , David Gow , Rae Moar , Andrew Morton , Oscar Salvador , Lorenzo Stoakes , Vlastimil Babka , Michal Hocko , linux-kselftest@vger.kernel.org, kunit-dev@googlegroups.com, linux-kernel@vger.kernel.org, linux-mm@kvack.org, Yosry Ahmed References: <20250224-page-alloc-kunit-v1-0-d337bb440889@google.com> <0449ff75-0a6b-4c1e-bf12-ff052aad5287@redhat.com> 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 B3JfpUqcWwE7vUaYr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jqY0VVqSUwImzTDLX9S4g/8 kC4HRcclk8hpyhY2jKGluZO0awwTIMgVEzmTyBphDg/Gx7dZU1Xf8HFuE+UZ5UDHDTnwgv7E th6RC9+WrhDNspZ9fJjKWRbveQgUFCpe1sa77LAw+XFrKmBHXp9ZVIe90RMe2tRL06BGiRZr jPrnvUsUUsjRoRNJjKKA/REq+sAnhkNPPZ/NNMjaZ5b8Tovi8C0tmxiCHaQYqj7G2rgnT0kt WNyWQQ== Organization: Red Hat In-Reply-To: X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: Zzzg5xdz-mEK_i7J4So4obfv-HkDBbDFPS-5SPUnp4k_1740570752 X-Mimecast-Originator: redhat.com Content-Language: en-US Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: D07F740005 X-Rspamd-Server: rspam08 X-Rspam-User: X-Stat-Signature: f9tqdixe3a6zcrsppnsyeiuxtdb5nwpd X-HE-Tag: 1740570754-468823 X-HE-Meta: U2FsdGVkX18bEsQNBHrimlFE88sf4RIltEilID9UOyQ1pQ7Vz6Ypb+aL+SAUaqpe9tnLVXGdbz5UmxrghTDahGvNxS3v22ULiuD8QbkVlHdtXJ5OcLbzhmfYeUgn11EY41rU5mh4WFhH16eHU0u1zLZ3s4UBAvR+LwBG7Aqr0TRxdKxa0/ZT6tjFWtmL2BaPDbCRnDZoP8sOecajuMw9xY50j8LYla0bgNV8WJUe8am+Nz2eXOY/hr7q6TubGXdhV371riQij14gjLv9FndzaJUp31Ks2lqSb00Yr80xx5f1MxNqu1TkIg6Gq/+mFgpmqdxwrT5PGR0To/B61fefNn6+TjvTUe1F4T9ctRrOxAmN/FtChR53/ifDcUrluDx5rhXpP4ZpHlpNYFef9m2jZx05pctcueOTahvNWhBCASO6v46ak9gup4Xsav78xleFacE31GMuai7f0/GtLbJjoTHek3hiB1GyzRq4FE7j/O9q/+Q/boSheGmqj2GdNXB+1nO6oP3r3h7MxIBEE/FJVgjndWsmSAY7t2gYZaLSQS0RpKszHOII94PlSIpLVZvGVqZS9bjWp38cQv6c/F3GXrLL+icO4nGf9l4FzLvJlo8e+67CtS6SA/LV5f+ivqIyGLutU2rfwEH6pSijXJxu64NCGoE9UBe3s4SAYFDnlO4suT7/Tv+0XYhK50ZeBItlXuJ36qjduIIkVnJKFJ9uNi23hXB0WwBB0ErK/6eg0txD4GoZDsZ7Og4Zciyu7gPbd7wWn+VPbKIdOilm1pf9od+c+0iSb0Cw7cramW7u05gBxPFAtlGAmzCUruYt8hk+siT2RomNqnK27RTHo4VKz+xsQOz78IL1Knk+5RLcxq05OWkwY/fA7DSEbhvYTKCULcUttq+Bi+CdQLpaMNktsiulNJmRBHcU12L3WPUkKRjcQCAU+SFhyUFYDL9r/CamJTuZyHjf7/ZV7sR8fxI mX9JgB/k DXrWYWvcX1cP+yiDKYzYZdwzJkFvEW2CgHqtdhqbxZSb1KfDm8/OkgDdKubeLMSNgMUwvvcU6EfISw1VDcVctoqQ/h3iUTlQXaaBp8T6SIIvknOCBCUyC5eDY8hdyGDCRPprRCT7O1FmuobKQavmuu8ez64bBHh5YbP6EoL02aB2zoOw2Ua9gmXkcvdLmZp3DDrOxYzvU4FaojhYedwF7ZZ+m7LDAYcZevAAwQ/Ksgiomop/CqdeNPW0YK1swwlSRYPWIWJHQsZHVwiTRq24VLach3KvjhQGzOgpor1ovuRZzC80lZygcooM6tzoxRP865PXuHhtIaHNwZWcRliRGSYX97+PFBoW/+azg1Wy6w/svdhR9Yo8mALkudvxE3RBANKhKJBkjiiWGerA= X-Bogosity: Ham, tests=bogofilter, spamicity=0.000014, 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 25.02.25 13:56, Brendan Jackman wrote: > On Tue, Feb 25, 2025 at 11:01:47AM +0100, David Hildenbrand wrote: >>> This is an RFC and not a PATCH because: >>> >>> 1. I have not taken much care to ensure the isolation is complete. >>> There are probably sources of flakiness and nondeterminism in here. >>> >>> 2. I suspect the the basic idea might be over-complicated: do we really >>> need memory hotplug here? Do we even need the instance of the >>> allocator we're testing to actual memory behind the pages it's >>> allocating, or could we just hallucinate a new region of vmemmap >>> without any of that awkwardness? >>> >>> One significant downside of relying on memory hotplug is that the >>> test won't run if we can't hotplug anything out. That means you have >>> to fiddle with the platform to even run the tests - see the >>> --kernel_args and --qemu_args I had to add to my kunit.py command >>> above. >>> >>> So yeah, other suggestions welcome. >>> >>> 2b. I'm not very confident I'm using the hotplug API properly. >> >> Me neither ;) >> >> Dynamically adding memory to that "fake" node is certainly interesting, but >> which guarantees do we have that some other features (page migration, memory >> offlining, page reporting ...) don't interact in weird ways with this "fake" >> node? Adding special-casing all over the place for that feels wrong. I >> assume this is point 1. you note above. > > Yeah, basically this is the big downside. Changing the system we're > trying to test in order to make it testable can't be avoided entirely, > but I am also pretty unhappy with sprinkling "if (node_isolated(node))" > everywhere. > > I guess the ideal approach is one where, instead of having to modify > the meaning of node_data, we just support replacing it completely, > e.g: > > struct page *__alloc_frozen_pages_noprof(gfp_t gfp, unsigned int order, > int preferred_nid, nodemask_t *nodemask, > struct pagelist_data *node_data) > { > struct alloc_context ac = { .node_data = node_data }; > > // ... > } > > Ideally this could be done in such a way that it disappears completely > outside of KUnit builds, the interface should be private and we'd > wanna get rid of any unnecessary pointer chasing with stuff like: > > #ifdef CONFIG_PAGE_ALLOC_KUNIT_TESTS > static inline struct ac_node_data(struct alloc_context *ac, int node) > { > return ac->node_data[node]; > } > #else > #define ac_node_data(ac, node) (NODE_DATA(node)) > #endif > > I initially rejected this approach because it felt "too intrusive", > but now that I've actually written this RFC I think it could be less > intrusive than the node_isolated() thing I've proposed here. > > The most obvious challenges I can see there are: > > - There might be places that page_alloc.c calls out to that care about > node_data but where we really don't want to plumb the alloc_context > through (maybe vmscan.c is already such a place)? > > - I dunno how many more such helpers we'd need beyond ac_node_data(), > like do we need ac_nodes_possible_mask() etc etc etc? > > But maybe worth a try - can you see any obvious reason this idea is > stupid? > >> So I don't quite love the idea on first sight ... but I haven't grasped all >> details of the full picture yet I'm afraid. > > Do you have any thoughts about "making up" memory instead of > hot-unplugging real memory for test usage? That might simplify things > a bit? > > It seems possible that very little mm code cares if the memory we're > managing actually exists. (For ASI code we did briefly experiment with > tracking information about free pages in the page itself, but it's > pretty sketchy and the presence of debug_pagealloc makes me think > nobody does it today). At least when it comes to the buddy, only page zeroing+poisoning should access actual page content. So making up memory might actually work in quite some setups, assuming that it will never get allocated. The "complicated" thing is still that we are trying to test parts of the buddy in a well-controlled way while other kernel infrastructure is using the buddy in rather uncontrolled ways. > > There might be arch-specific issues there, but for unit tests it > seems OK if they don't work on every ISA. Just pointing it out: for memblock tests (tools/testing/memblock/) we actually compile memblock.c to be used in a user space application, stubbing all external function calls etc such that we get the basics running. It'd probably be quite some work to get page_alloc.c into a similar shape, likely we'd have to move a lot of unrelated-for-the tests stuff, and think about how to handle some nasty details like pcp etc. Just wondering, did you think about that option as well? The nice thing about such an approach is that we can test the allcator without any possible side effects from the running system. -- Cheers, David / dhildenb