From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wm1-f48.google.com (mail-wm1-f48.google.com [209.85.128.48]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 009603E00B2 for ; Wed, 27 May 2026 08:41:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.48 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779871277; cv=none; b=GenoM3KOBpeSJtOu8ZewmOIY/rn8MUAL5arRrKvaSB3/V2OuWmGbQ9BUZ/q3kvh9A8LhByAfYr8KUg4N1rglddB/D1iEBvl2XugPL/zDxoy9HH3maSDt/y+wOzDEi1mdO7iZ7t3qBzJJtDkuvUM/HDTuC4t55974bdtDZAY9xTY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779871277; c=relaxed/simple; bh=4RJdtlvXAonvNJZVVS4YO0NxuX760SrZITEJGLud96Q=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=Bu8Nbn4N9okyRjk8uQ74w1MccYha973wTiZv6IyWt6bGlGazifRt0wd/8ebaaqvxltmSuKkKBhCeZwmQCTIZEkTodqtGstf7ABueCcpzUwqKo+0UcdyVe9BaBDphGROiQJRlQtuzfIZVrHnd7BP3/9doDQ+ap7RrUdTN6NoLBcg= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=suse.com; spf=pass smtp.mailfrom=suse.com; dkim=pass (2048-bit key) header.d=suse.com header.i=@suse.com header.b=dNNwg4tT; arc=none smtp.client-ip=209.85.128.48 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=suse.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=suse.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=suse.com header.i=@suse.com header.b="dNNwg4tT" Received: by mail-wm1-f48.google.com with SMTP id 5b1f17b1804b1-4896c22fcbaso97759665e9.0 for ; Wed, 27 May 2026 01:41:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=google; t=1779871273; x=1780476073; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=DS0Qvfn3wnYHQZFbMC98i7Jr1S1IM77hBEnuir22yHQ=; b=dNNwg4tTpdu7BkPDE1ZpE49k2VDVj1RPm4bpuKQnFukECrqhCuudjBvHhnL3x6BAR3 rfKP/M/ubl1shpQq/C9pletl+m+azk2SNGfETMlIZNdor5sW+7lCR8MReJZdywaYCV2Y Al7fJ5Be3aFl9z4523ddvC/xq3ElMoLFEAKuRBXB/TT1ne2Pg9aAoRFsnFwrQ6EK13ke WDDwMshk8NgfYMP54IMH1GQqDEI31bPwbkTrpeSHT81GY70SZQ/aUQUKChcg2yoV+Ktn +VXVJoUM1X8814/G6ZBX28T3F3D4ZDkPY5bE3UNd6AYu+naPnH5zl8ydgbHmz2jaNkqD SAFQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1779871273; x=1780476073; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-gg:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=DS0Qvfn3wnYHQZFbMC98i7Jr1S1IM77hBEnuir22yHQ=; b=Iz+YR6OS3PleW8f0yr/Hdu5lihAsreujUS6dY7bCV8VkMITTlbLSb7yVSBMgxQ4Krl BxIC5cCK1giniuka9I4y9ybIOQB+/ORfMxuYTiyOTfvqKKZ6rZci3P92NfXob2wbPo0F RousfXkxHIa4w+ykRMzU8mw0O3VhW3c3dYDMrVC5OYlv1Tf8/Iy5NmD4zog0ohIUXm4S rJE9vBYadoHr/A9OiX+4DNdMaqmkvXRc/kO+HMVndi9wD8zYhVOCWX1EBDhk83mA/Jc5 b1AAyDKMeEv598/FeS838KBqQFqM4PUcXJLw0e9b6eh+J9lgKY3E1mMbcA2682RIhnm+ aiCg== X-Forwarded-Encrypted: i=1; AFNElJ+6ghvWPe1ymt4VedKD/wfiytvt26yx0E8e0PPB9M3mwq3y8Xvu/6zJOhKK0Wx7NRwntL29LFQv5sSlfmc=@vger.kernel.org X-Gm-Message-State: AOJu0YyLsU+5w60AE4nrzpIFq+eHQtA4Y8b6TY0MaCjcXdpn+cdyfg44 QTGu6MIU4ylyVXef2iwshRf8LUlaq8DlXnC3+5M0Aydv8ynXUVqVHFdNXQ2wVbHNDoA= X-Gm-Gg: Acq92OGCq6w7DTo4gtiO70QqKcEpuakrxST3aT3edsuyk61q8CpGomvZEzwrOi7inGb gjugzFjw9iHT8GHlKyd/Cv42JR8iFQlKJkwQW4iAWuuVkEgFvSLj/D9dBhFkhEJuslsv7/57kEJ 5WjYVNEA7YpMJAr8a6gWZmnFoIEu0CPmmMH4LgunsNCDYdk9YFxIwD88IGtz9XRyjzyJq/gOyCa f97fhDx/FxCwvkj4HrwNrQhtM836fnZsX2krQphIxRGD7DWAju8+EAWqd5dqeUCw1wkYN3T7VXl ywf4fWgyruX5vbpw1uELFUqEzhNsGBE9CG3XJl6I3++Akgx/Q0gMCI1ldkPbtftDYOHWfHfTK64 FPIhJa1O2/KMfz80XB24sCp3hA0aL0xTjgZNvtgKFVzMHvz/+DDS1y5wds7Z2iH75Mes+ZseJPe dVEbvNO7MLWI2NYJmrkgWB9aOg/GpWCHIn3t26LCy658yA X-Received: by 2002:a05:600d:644d:20b0:490:3cb4:f1b3 with SMTP id 5b1f17b1804b1-490426c5a3dmr265077595e9.16.1779871273108; Wed, 27 May 2026 01:41:13 -0700 (PDT) Received: from localhost (109-81-80-71.rct.o2.cz. [109.81.80.71]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-490454a0cd5sm472671585e9.10.2026.05.27.01.41.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 27 May 2026 01:41:12 -0700 (PDT) Date: Wed, 27 May 2026 10:41:11 +0200 From: Michal Hocko To: "Vlastimil Babka (SUSE)" Cc: Waiman Long , Marc Zyngier , Thomas Gleixner , Sebastian Andrzej Siewior , Clark Williams , Steven Rostedt , Andrew Morton , David Hildenbrand , Lorenzo Stoakes , "Liam R. Howlett" , Mike Rapoport , Suren Baghdasaryan , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, linux-rt-devel@lists.linux.dev Subject: Re: [PATCH 1/2] gfp_types: Introduce a new GFP_ATOMIC_RT gfp flag Message-ID: References: <20260520204628.933654-1-longman@redhat.com> <16b36b01-7da2-4ec4-aefa-f06216ec218a@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <16b36b01-7da2-4ec4-aefa-f06216ec218a@kernel.org> On Tue 26-05-26 15:55:09, Vlastimil Babka (SUSE) wrote: > On 5/25/26 10:41 AM, Michal Hocko wrote: > > On Wed 20-05-26 16:46:27, Waiman Long wrote: > >> The GFP_ATOMIC flag is to be used in atomic context where user cannot > >> sleep and need the allocation to succeed. However, it does not support > >> contexts where preemption or interrupt is disabled under PREEMPT_RT > >> like raw_spin_lock_irqsave() or plain preempt_disable(). > >> > >> With the advance of the ALLOC_TRYLOCK allocation flag in the v7.1 > >> kernel, it is possible to allocate memory under such contexts by using > >> spin_trylock to acquire the spinlock in the memory allocation path. This > >> does increase the chance that the allocation can fail due to the presence > >> of concurrent memory allocation requests. So its users must be able to > >> handle such memory allocation failure gracefully. > >> > >> The ALLOC_TRYLOCK flag will only be enabled if none of the > >> ___GFP_DIRECT_RECLAIM and ___GFP_KSWAPD_RECLAIM flags are set. > >> > >> Introduce a new GFP_ATOMIC_RT gfp flag for those PREEMPT_RT > >> atomic contexts. This new flag will fall back to GFP_ATOMIC in > >> non-PREEMPT_RT kernel. GFP_ATOMIC can continue to be used in contexts > >> where preemption and interrupt are not disabled in PREEMPT_RT kernel > >> like spin_lock_irqsave(). > > > > Before we go this way we need to really be clear we do want to support > > raw_spinlock (aka RT) contexts. This is a big commitment because it > > dictates internal allocator locking that would have potentially a much > > bigger impact long term. I would go this way only after/when we conclude > > there is absolutely no other way and we need to have allocator in those > > critical sections. Now you have a single place which complains ATM > > We already have alloc_pages_nolock() which uses ALLOC_TRYLOCK internally > for these limited contexts. So the support and commitment exist. This > just exposes it via a new gfp flag alias. But if there's a single user > and it's already disputed, we don't have to expose it that way indeed. alloc_pages_nolock is a very constrained allocation context with a very limited use. That is quite different from something as generically named as GFP_ATOMIC_RT that one could assume is a good fit for RT sensitive allocations in general. -- Michal Hocko SUSE Labs