From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from out-171.mta0.migadu.com (out-171.mta0.migadu.com [91.218.175.171]) (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 4E0782EEE7C for ; Fri, 3 Jul 2026 11:43:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.218.175.171 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783079038; cv=none; b=F8QqvFOzhP1+zEu2c+Cy6SVIzsSZFLlIGKwET3mG5OAhdGrXqGWyQ6LMV3TOkUMUCgsZMOe4WVO7ohUy01d96mSu55E4Swf3ijU+zKWvAGyjrtUpNwzjNFIOqfVVBakjW6EP44N5EKPNZ7f/bCLR2NVfDGRoxgQqHbsAfoX9DZM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783079038; c=relaxed/simple; bh=VSetS396SrH76litqhz6V0tLsyOUbEp17iVMUlqbZ0A=; h=Mime-Version:Content-Type:Date:Message-Id:Cc:Subject:From:To: References:In-Reply-To; b=MtPgB6zhLj3G61IEnoU+1bjU+LxVWjykxhi5xQAZyBKyMcYRinCPHfJEBQXgEI+uTctR4z+U6hIRIJOefqXfgFQDL3S9YquguMdXFkCHmSxnGRxKGtHp2xB9ZcfIoT2vj5VDIpQZdt0vlewBno48RDqAIJho2AzjBOkdypt2hxk= 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=axBe2JTE; arc=none smtp.client-ip=91.218.175.171 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="axBe2JTE" Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1783079024; 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=VSetS396SrH76litqhz6V0tLsyOUbEp17iVMUlqbZ0A=; b=axBe2JTE4wy9jYDVh/aDcxlWFqplgDs/zl2EfbLtmG9mqQTYZV5rPg/mysAbrTIYroHQun imD73iN1OFVJuv2JTbrfrEOVOfWxT3+/GG9kaJQRW5kMdQ8aqP0fGcDHhwBu9Ypv9V+6iW 7YqnlKUsRosMN4yi746SiqKn2nh99fI= Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=UTF-8 Date: Fri, 03 Jul 2026 11:43:39 +0000 Message-Id: Cc: "Harry Yoo (Oracle)" , "Gregory Price" , "Alexei Starovoitov" , "Matthew Wilcox" , "Hao Ge" , , , , , , "Yosry Ahmed" Subject: Re: [PATCH v4 18/18] mm: factor out can_spin_trylock() X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: "Brendan Jackman" To: "Vlastimil Babka (SUSE)" , "Brendan Jackman" , "Andrew Morton" , "Suren Baghdasaryan" , "Michal Hocko" , "Johannes Weiner" , "Zi Yan" , "Muchun Song" , "Oscar Salvador" , "David Hildenbrand" , "Lorenzo Stoakes" , "Liam R. Howlett" , "Mike Rapoport" , "Matthew Brost" , "Joshua Hahn" , "Rakie Kim" , "Byungchul Park" , "Ying Huang" , "Alistair Popple" , "Hao Li" , "Christoph Lameter" , "David Rientjes" , "Roman Gushchin" , "Sebastian Andrzej Siewior" , "Clark Williams" , "Steven Rostedt" References: <20260702-alloc-trylock-v4-0-0af8ff387e80@google.com> <20260702-alloc-trylock-v4-18-0af8ff387e80@google.com> <1e162a97-1594-495d-b48e-7dafaa0a6d82@kernel.org> In-Reply-To: <1e162a97-1594-495d-b48e-7dafaa0a6d82@kernel.org> X-Migadu-Flow: FLOW_OUT On Fri Jul 3, 2026 at 9:32 AM UTC, Vlastimil Babka (SUSE) wrote: > On 7/2/26 11:49, Brendan Jackman wrote: >> Deduplicate checks for whether the current context is safe for >> spin_trylock(). >>=20 >> Does this function really belong in mm/internal.h or is it generic? Not >> sure. If someone ends up duplicating this logic elsewhere in the kernel, >> that would be a shame. But goes in some generic header, someone treats >> it as documentation about where it's guaranteed safe to spin_trylock(), >> and then it emerges that there are other subtle preconditions that >> didn't affect the mm usecase, that would be worse. So, just be >> conservative and keep it local. > > Agreed. We could even use page_alloc.h ? Would be nice to shrink the scope but I think it would be "wrong" for slub.c to get it from there. It's not to do with the page allocator.