From patchwork Thu Jul 11 16:35:31 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vlastimil Babka X-Patchwork-Id: 13730861 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 4D5ABC3DA45 for ; Thu, 11 Jul 2024 16:35:56 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id C8A976B0093; Thu, 11 Jul 2024 12:35:52 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id C3AE86B0099; Thu, 11 Jul 2024 12:35:52 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id A4FA16B009D; Thu, 11 Jul 2024 12:35:52 -0400 (EDT) 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 87E596B0099 for ; Thu, 11 Jul 2024 12:35:52 -0400 (EDT) Received: from smtpin18.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id E7CC91A0608 for ; Thu, 11 Jul 2024 16:35:51 +0000 (UTC) X-FDA: 82328023302.18.CDBBDBD Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.223.131]) by imf12.hostedemail.com (Postfix) with ESMTP id 74ACF40009 for ; Thu, 11 Jul 2024 16:35:49 +0000 (UTC) Authentication-Results: imf12.hostedemail.com; dkim=pass header.d=suse.cz header.s=susede2_rsa header.b=1vjIwBql; dkim=pass header.d=suse.cz header.s=susede2_ed25519 header.b=e6+8AlnT; dkim=pass header.d=suse.cz header.s=susede2_rsa header.b=1vjIwBql; dkim=pass header.d=suse.cz header.s=susede2_ed25519 header.b=e6+8AlnT; spf=pass (imf12.hostedemail.com: domain of vbabka@suse.cz designates 195.135.223.131 as permitted sender) smtp.mailfrom=vbabka@suse.cz; dmarc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1720715733; 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=J+/ijafGrQuEAmygURDp1dii/TCJWacbVmiHu5ugO0M=; b=vC5bkSw26LTsFbJKboFszbze6UG+aLzFIiEd6wLzdMR9kQOKnAxJuEBqJY0ZNtir/Ca9jY 4u/ap0W++itAemcpPS5kZYaVx41Ekt8W5Ryt7Ou/cYnCsP0FgDnvGQfOZRw1alfED6m2QC oGlELiZqJjJWGRlGwmJVKw83wKc98Cc= ARC-Authentication-Results: i=1; imf12.hostedemail.com; dkim=pass header.d=suse.cz header.s=susede2_rsa header.b=1vjIwBql; dkim=pass header.d=suse.cz header.s=susede2_ed25519 header.b=e6+8AlnT; dkim=pass header.d=suse.cz header.s=susede2_rsa header.b=1vjIwBql; dkim=pass header.d=suse.cz header.s=susede2_ed25519 header.b=e6+8AlnT; spf=pass (imf12.hostedemail.com: domain of vbabka@suse.cz designates 195.135.223.131 as permitted sender) smtp.mailfrom=vbabka@suse.cz; dmarc=none ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1720715733; a=rsa-sha256; cv=none; b=qd4a/wiw8MxTo04M/Rf+K9LbhKJijvtiCWNwkJQbzOXpUp8Fp6lFzuz1OM1WDlzTPX+gO0 WjqFYCBjnKKVQCPnmlajIt/0xR1UFFA9uew0E20eUaoC+nBK/KlVnSxy35EPcftvJXFhCd Vdhnenn1wFJ6/rQsdO+m9M1YPE0HE74= Received: from imap1.dmz-prg2.suse.org (unknown [10.150.64.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id CDA3C1FB45; Thu, 11 Jul 2024 16:35:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1720715747; h=from:from:reply-to: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=J+/ijafGrQuEAmygURDp1dii/TCJWacbVmiHu5ugO0M=; b=1vjIwBqlGi1zXkVB5eD7IxpkGp+lGUlKXzS1EhgL9L5bUX7xPFJ50YnopKvq5nhFA+m9FV sIfpuoRVBCqjmCXCeWZSMtwBrihjUWupaq2v397zz8OZ9bl5FMAZIthTlCyTO3DmG5iV0J 8iKiXQWD+Zm4y9BvYrx1asJMWUvo264= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1720715747; h=from:from:reply-to: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=J+/ijafGrQuEAmygURDp1dii/TCJWacbVmiHu5ugO0M=; b=e6+8AlnTfXhubvRLZci/XZtXlROwS05vLXKyQh0zw+SiMf76sXetl2mfZ9yTsc7keb6668 vRrkuEQ6yh2nJ+DQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1720715747; h=from:from:reply-to: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=J+/ijafGrQuEAmygURDp1dii/TCJWacbVmiHu5ugO0M=; b=1vjIwBqlGi1zXkVB5eD7IxpkGp+lGUlKXzS1EhgL9L5bUX7xPFJ50YnopKvq5nhFA+m9FV sIfpuoRVBCqjmCXCeWZSMtwBrihjUWupaq2v397zz8OZ9bl5FMAZIthTlCyTO3DmG5iV0J 8iKiXQWD+Zm4y9BvYrx1asJMWUvo264= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1720715747; h=from:from:reply-to: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=J+/ijafGrQuEAmygURDp1dii/TCJWacbVmiHu5ugO0M=; b=e6+8AlnTfXhubvRLZci/XZtXlROwS05vLXKyQh0zw+SiMf76sXetl2mfZ9yTsc7keb6668 vRrkuEQ6yh2nJ+DQ== Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id A696713A63; Thu, 11 Jul 2024 16:35:47 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id 8FFeKOMJkGa0NwAAD6G6ig (envelope-from ); Thu, 11 Jul 2024 16:35:47 +0000 From: Vlastimil Babka Date: Thu, 11 Jul 2024 18:35:31 +0200 Subject: [PATCH 2/2] mm, page_alloc: put should_fail_alloc_page() back behing CONFIG_FAIL_PAGE_ALLOC MIME-Version: 1.0 Message-Id: <20240711-b4-fault-injection-reverts-v1-2-9e2651945d68@suse.cz> References: <20240711-b4-fault-injection-reverts-v1-0-9e2651945d68@suse.cz> In-Reply-To: <20240711-b4-fault-injection-reverts-v1-0-9e2651945d68@suse.cz> To: Andrew Morton Cc: Mateusz Guzik , Akinobu Mita , Alexei Starovoitov , Daniel Borkmann , John Fastabend , Andrii Nakryiko , Martin KaFai Lau , Eduard Zingerman , Song Liu , Yonghong Song , KP Singh , Stanislav Fomichev , Hao Luo , Jiri Olsa , Christoph Lameter , David Rientjes , Roman Gushchin , Hyeonggon Yoo <42.hyeyoo@gmail.com>, linux-kernel@vger.kernel.org, bpf@vger.kernel.org, linux-mm@kvack.org, Vlastimil Babka X-Mailer: b4 0.14.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=3580; i=vbabka@suse.cz; h=from:subject:message-id; bh=4AqxrxUC+zfM0+8kA2b6/+AVqXKWW+es4dahXRrWf9U=; b=owEBbQGS/pANAwAIAbvgsHXSRYiaAcsmYgBmkAngPeXxGyMkwii0N7B0er/MDHjesPfUH0C4n M4O0JQqZxOJATMEAAEIAB0WIQR7u8hBFZkjSJZITfG74LB10kWImgUCZpAJ4AAKCRC74LB10kWI mlNMCACBpN6laStmKCOU85jVrU53kCUjhV4Tx585ZQSz63G/gfS43dJ8ggD9B5v3hDdKWrDtCmW q/n8NzPhr7PQMY6Ke66DfHbCiUXslGBJE8ij1AwDLkrISD444GFfvfp5PCAeOQ0GsOmMdsf4vjg tQRJcaIPmF43S0R5etsONl9qvK/HfD1SsVZ8LPLIzl96Y0B6BUUAerap+qLTATzqvzYw1S+lGnk IA1dgU6v3DaYMg36THyW8dwuReZhA67MDZ3gDlz2SRPY5Qr9ScCc5ADqVoSKkmTSL1tRXGIxm51 CBhnsQGN83sj8kU2W2ZOTQIftp6fYEz//VkHvDX1D+/br88v X-Developer-Key: i=vbabka@suse.cz; a=openpgp; fpr=A940D434992C2E8E99103D50224FA7E7CC82A664 X-Rspamd-Server: rspam03 X-Rspam-User: X-Rspamd-Queue-Id: 74ACF40009 X-Stat-Signature: aci78bkqb6m77a9x8dqfdpof6izrgeyd X-HE-Tag: 1720715749-217691 X-HE-Meta: U2FsdGVkX19n6hMK/iv3YX0iI5g6ZI4FDuMhAuxZ1TzTl1OYEOEhrXB9dK7sudDMTFTGfJ2QQhN9kQplz5eLLtuTeafRMh0JzJZ9aGlTN8XZiJ5V49IbntS6/92OgZux2uGUozGO2gG6SUWlVWDzYqv7eQZo+NvBp1WVyoT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/P4wnQ1Ql+g+46Yqk/hJFcZe/2AHWGCYFviqnV4ORgHh+Td37WZujBo+PoOTBfmN9TO/abikx37KluK0yJnivBM2Diecdyu1c X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: This mostly reverts commit af3b854492f3 ("mm/page_alloc.c: allow error injection"). The commit made should_fail_alloc_page() a noinline function that's always called from the page allocation hotpath, even if it's empty because CONFIG_FAIL_PAGE_ALLOC is not enabled, and there is no option to disable it and prevent the associated function call overhead. As with the preceding patch "mm, slab: put should_failslab back behind CONFIG_SHOULD_FAILSLAB" and for the same reasons, put the should_fail_alloc_page() back behind the config option. When enabled, the ALLOW_ERROR_INJECTION and BTF_ID records are preserved so it's not a complete revert. Signed-off-by: Vlastimil Babka --- include/linux/fault-inject.h | 6 ++---- kernel/bpf/verifier.c | 2 ++ mm/fail_page_alloc.c | 4 +++- mm/page_alloc.c | 6 ------ 4 files changed, 7 insertions(+), 11 deletions(-) diff --git a/include/linux/fault-inject.h b/include/linux/fault-inject.h index be6d0bc111ad..354413950d34 100644 --- a/include/linux/fault-inject.h +++ b/include/linux/fault-inject.h @@ -91,12 +91,10 @@ static inline void fault_config_init(struct fault_config *config, struct kmem_cache; -bool should_fail_alloc_page(gfp_t gfp_mask, unsigned int order); - #ifdef CONFIG_FAIL_PAGE_ALLOC -bool __should_fail_alloc_page(gfp_t gfp_mask, unsigned int order); +bool should_fail_alloc_page(gfp_t gfp_mask, unsigned int order); #else -static inline bool __should_fail_alloc_page(gfp_t gfp_mask, unsigned int order) +static inline bool should_fail_alloc_page(gfp_t gfp_mask, unsigned int order) { return false; } diff --git a/kernel/bpf/verifier.c b/kernel/bpf/verifier.c index e455654f3b91..a81e18409ec9 100644 --- a/kernel/bpf/verifier.c +++ b/kernel/bpf/verifier.c @@ -21122,7 +21122,9 @@ BTF_SET_START(btf_non_sleepable_error_inject) * Assume non-sleepable from bpf safety point of view. */ BTF_ID(func, __filemap_add_folio) +#ifdef CONFIG_FAIL_PAGE_ALLOC BTF_ID(func, should_fail_alloc_page) +#endif #ifdef CONFIG_FAILSLAB BTF_ID(func, should_failslab) #endif diff --git a/mm/fail_page_alloc.c b/mm/fail_page_alloc.c index b1b09cce9394..532851ce5132 100644 --- a/mm/fail_page_alloc.c +++ b/mm/fail_page_alloc.c @@ -1,5 +1,6 @@ // SPDX-License-Identifier: GPL-2.0 #include +#include #include static struct { @@ -21,7 +22,7 @@ static int __init setup_fail_page_alloc(char *str) } __setup("fail_page_alloc=", setup_fail_page_alloc); -bool __should_fail_alloc_page(gfp_t gfp_mask, unsigned int order) +bool should_fail_alloc_page(gfp_t gfp_mask, unsigned int order) { int flags = 0; @@ -41,6 +42,7 @@ bool __should_fail_alloc_page(gfp_t gfp_mask, unsigned int order) return should_fail_ex(&fail_page_alloc.attr, 1 << order, flags); } +ALLOW_ERROR_INJECTION(should_fail_alloc_page, TRUE); #ifdef CONFIG_FAULT_INJECTION_DEBUG_FS diff --git a/mm/page_alloc.c b/mm/page_alloc.c index 9ecf99190ea2..91b7234f1d7e 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -3031,12 +3031,6 @@ struct page *rmqueue(struct zone *preferred_zone, return page; } -noinline bool should_fail_alloc_page(gfp_t gfp_mask, unsigned int order) -{ - return __should_fail_alloc_page(gfp_mask, order); -} -ALLOW_ERROR_INJECTION(should_fail_alloc_page, TRUE); - static inline long __zone_watermark_unusable_free(struct zone *z, unsigned int order, unsigned int alloc_flags) {