From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 1F82426B0A5; Thu, 13 Feb 2025 15:17:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1739459852; cv=none; b=bNeneFZw4fhzzrDjKD38oC8JzAARt8spxpHUskTJjRzEw4pxHmkoKfRP2+ADsaF+332IEu48k5FslGpt/9vJ66l/usAUou26Ptkhzn3pgvvia/amG9hhe/NqvP6EF5EdnNnUMP33r9SXJCO8Vx1GhjGaUCP1aTiJFKM1TEXnugU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1739459852; c=relaxed/simple; bh=pEZqG5fp7qbiGsgEEGooLdHJvGvEkbcGtBu82J47qHk=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=lIqO2Hhs3BsQVSfkTr7Kj2brRoR8l6jAEU8ucMfRCbISBn55ksGsZIYqTqHBQRyU3JYTCZ2xk62M3F/NTwLkq6VzRRgE/Qltb4D/JB/h/ppVq8jV+nOGePYGN2LA6PQtHmlNMdLJ0XH+FkJBstHmCblunN41+e3a97ITU2oS2+g= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=p0bz3INI; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="p0bz3INI" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8F96BC4CED1; Thu, 13 Feb 2025 15:17:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1739459852; bh=pEZqG5fp7qbiGsgEEGooLdHJvGvEkbcGtBu82J47qHk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=p0bz3INI2DfXpJ6O4qcE1CPdUMuHGWIVU9HviPHzH7c4cpf2hRY4rH+/9ynxeD23T Ad/4RVOaSu1JyysfFjdrsWdGg3HbeZs34gDulfUvcy6r0v0ddgKA4VvrBtnLbdOPww KBbhRmkRSBk53AICQNMaA/EH+ad9YFSuQaIwUzkE= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Marco Elver , Vlastimil Babka , Christoph Lameter , Alexander Potapenko , Dmitriy Vyukov , Andrew Morton Subject: [PATCH 6.13 341/443] kfence: skip __GFP_THISNODE allocations on NUMA systems Date: Thu, 13 Feb 2025 15:28:26 +0100 Message-ID: <20250213142453.781476151@linuxfoundation.org> X-Mailer: git-send-email 2.48.1 In-Reply-To: <20250213142440.609878115@linuxfoundation.org> References: <20250213142440.609878115@linuxfoundation.org> User-Agent: quilt/0.68 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.13-stable review patch. If anyone has any objections, please let me know. ------------------ From: Marco Elver commit e64f81946adf68cd75e2207dd9a51668348a4af8 upstream. On NUMA systems, __GFP_THISNODE indicates that an allocation _must_ be on a particular node, and failure to allocate on the desired node will result in a failed allocation. Skip __GFP_THISNODE allocations if we are running on a NUMA system, since KFENCE can't guarantee which node its pool pages are allocated on. Link: https://lkml.kernel.org/r/20250124120145.410066-1-elver@google.com Fixes: 236e9f153852 ("kfence: skip all GFP_ZONEMASK allocations") Signed-off-by: Marco Elver Reported-by: Vlastimil Babka Acked-by: Vlastimil Babka Cc: Christoph Lameter Cc: Alexander Potapenko Cc: Chistoph Lameter Cc: Dmitriy Vyukov Cc: Signed-off-by: Andrew Morton Signed-off-by: Greg Kroah-Hartman --- mm/kfence/core.c | 2 ++ 1 file changed, 2 insertions(+) --- a/mm/kfence/core.c +++ b/mm/kfence/core.c @@ -21,6 +21,7 @@ #include #include #include +#include #include #include #include @@ -1084,6 +1085,7 @@ void *__kfence_alloc(struct kmem_cache * * properties (e.g. reside in DMAable memory). */ if ((flags & GFP_ZONEMASK) || + ((flags & __GFP_THISNODE) && num_online_nodes() > 1) || (s->flags & (SLAB_CACHE_DMA | SLAB_CACHE_DMA32))) { atomic_long_inc(&counters[KFENCE_COUNTER_SKIP_INCOMPAT]); return NULL;