From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from out-173.mta0.migadu.com (out-173.mta0.migadu.com [91.218.175.173]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id AC15D3F8891 for ; Fri, 29 May 2026 15:02:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.218.175.173 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780066964; cv=none; b=MFP5i77VfwMJ89wGEsMsgP7MwSQZR5PUD8E7BIk9U+7AyXNFkSWDOwUo6BcyMFhy8R6NwvbhWOwo84Ue3eVbtBI6eh5vOsuh4NaRMPC5m7PB2QBPy8xhYg8PsR0X3RiWG9hC3iw4NJ9PfWCmSxn/fe5qql2d1jx5vDAc+ihEkWQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780066964; c=relaxed/simple; bh=JfgxKEJFgIyeDd7EWVwHz9xx+yxxbDNJKOF5UiLtf78=; h=Content-Type:Date:Message-Id:Cc:Subject:From:To:Mime-Version: References:In-Reply-To; b=uZLSWzOkfY2fM1qhkk+BQS3WHwmYPeneCiagBQAc1HGr5dbM1nOkM5kQ9fPJftLE8iCnwzLIe4a9ApvgjM8CVByEF+V9pPgYz3GeJZWnaz0JQ+lPvOmnOt11ZwPkGpogwOyeUd16M1lUsLcRgnXD3w83++9RifBdMbZ8aBf0+no= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=KHIjy/CF; arc=none smtp.client-ip=91.218.175.173 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="KHIjy/CF" Content-Type: text/plain; charset=UTF-8 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1780066960; 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; bh=Nr+g4bn7R579mD3Y03TuWUSeVDUqiKsP3+OhxcAEXrs=; b=KHIjy/CF1A3+4fzbwtgNcdW/l9N0WpDILcuvrdWVIYa4WplG55L86uPEkc35TEKL6rlYUs iPnP3NmgN1CtbzGPLA6myTQ+fCxPGlT+Kslpni2DUj5NdVXg/vUd7jAmfJ8wfucCXR5gvV sbqqEwE9gYyi6m18fUbOwMrKJPkYIH0= Date: Fri, 29 May 2026 15:02:33 +0000 Message-Id: Cc: , , , , "Sumit Garg" , , , "Will Deacon" , , "Kalyazin, Nikita" , , "Itazuri, Takahiro" , "Andy Lutomirski" , "David Kaplan" , "Thomas Gleixner" , "Yosry Ahmed" Subject: Re: [PATCH v2 19/22] mm/page_alloc: implement __GFP_UNMAPPED allocations X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: "Brendan Jackman" To: "Brendan Jackman" , "Vlastimil Babka (SUSE)" , "Borislav Petkov" , "Dave Hansen" , "Peter Zijlstra" , "Andrew Morton" , "David Hildenbrand" , "Wei Xu" , "Johannes Weiner" , "Zi Yan" , "Lorenzo Stoakes" Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 Content-Transfer-Encoding: quoted-printable References: <20260320-page_alloc-unmapped-v2-0-28bf1bd54f41@google.com> <20260320-page_alloc-unmapped-v2-19-28bf1bd54f41@google.com> <7bfda0d8-2a7a-4337-8b55-d0c158df7839@kernel.org> In-Reply-To: X-Migadu-Flow: FLOW_OUT On Fri May 15, 2026 at 4:46 PM UTC, Brendan Jackman wrote: > On Wed May 13, 2026 at 3:43 PM UTC, Vlastimil Babka (SUSE) wrote: [...] >> Uhh, speaking of compaction and reclaim... we rely on finding a whole fr= ee >> pageblock in order to flip it. If that doesn't exist, the whole >> get_page_from_freelist() will fail, and we might enter the >> reclaim/compaction cycle in __allow_pages_slowpath(). But since we might >> ultimately want an order-0 allocation, there won't be any compaction >> attempted, because that code won't know we failed to flip a pageblock. A= nd >> the watermarks might look good and prevent reclaim as well I think? We >> should somehow indicate this, and handle accordingly. Might not be trivi= al. >> Or maybe reuse pageblock isolation code to do the migrations directly in >> __rmqueue_direct_map? > > Ah, thanks, I suspect you are right. > > I did fear there would be some sort of case where this "not-quite > reclaim" interacted badly with the actual reclaim, and I tried to test > it by running some stuff in parallel with stress-ng (allocating > __GFP_UNMAPPED via secretmem), and I didn't see a difference in the > effective availability of memory. However, I suspect testing this is > quite a deep art my "run these two commands that I copy pasted from an > LLM suggestion" test was just crap. > > Do you have any workloads you can suggest for evaluating this kinda > thing? We would definitely see it in Google prod (I think we see this > kind of issue with our shrinker-based internal version of ASI distorting > reclaim behaviour in ways even more subtle than this) but that is not a > very practical experimental cycle... I slop-coded a benchmark: https://github.com/bjackman/kernel-benchmarks-nix/tree/master/packages/benc= hmarks/secretmem-vs-frag It does some mmap/munmap patterns to try and generate fragmentation, then spams secretmem allocations until it gets OOM-killed. With this series, I see the OOM-kills happening noticeably sooner on a 1GiB VM: metric: secretmem_allocated_bytes (B) | test: secretmem-vs-frag +---------------------------------------------+---------+-------------+----= ---------+-----------------+-------------+-------+ | kernel_release | samples | mean | = min | histogram | max | =CE=94=CE=BC | +---------------------------------------------+---------+-------------+----= ---------+-----------------+-------------+-------+ | 7.0.0-rc4-next-20260319 | 4 | 683,147,264 | 643= ,825,664 | =E2=96=88 | 715,128,832 | | | 7.0.0-rc4-next-20260319-00028-gf00246eb72cd | 3 | 623,553,195 | 551= ,550,976 | =E2=96=88=E2=96=88=E2=96=88 | 692,060,160 | -8.7% | +---------------------------------------------+---------+-------------+----= ---------+-----------------+-------------+-------+ So... I think maybe I've reproduced the issue you pointed out? I will try and fix it and see if this degradation goes away.