From patchwork Sat Dec 16 03:35:51 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kent Overstreet X-Patchwork-Id: 13495426 Received: from out-171.mta1.migadu.com (out-171.mta1.migadu.com [95.215.58.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 A771F14AAD for ; Sat, 16 Dec 2023 03:36:16 +0000 (UTC) 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="XEtPsaHY" X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1702697775; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=9mNDldpW72dzzPm2XiWKIN1gnNsmgtyhmZKpYp8TNSQ=; b=XEtPsaHY4Dmh0NEcxeo6xv7f2ym7o2IfV8/+qvppIKvuW8rL7syDOpqeXnCtLUbRWy3ay9 XUTcKSfr0H9Um73s8jIzA0dpG5SyaSVsv//HPpv6j5K8XxsJxUYi8LxxcHXGVIFo2kSSKH BrTDi66xvwaoqvzUoGgtuCKz5WtWL5I= From: Kent Overstreet To: linux-kernel@vger.kernel.org, linux-mm@kvack.org, linux-fsdevel@vger.kernel.org Cc: Kent Overstreet , tglx@linutronix.de, x86@kernel.org, tj@kernel.org, peterz@infradead.org, mathieu.desnoyers@efficios.com, paulmck@kernel.org, keescook@chromium.org, dave.hansen@linux.intel.com, mingo@redhat.com, will@kernel.org, longman@redhat.com, boqun.feng@gmail.com, brauner@kernel.org Subject: [PATCH 50/50] Kill sched.h dependency on rcupdate.h Date: Fri, 15 Dec 2023 22:35:51 -0500 Message-ID: <20231216033552.3553579-7-kent.overstreet@linux.dev> In-Reply-To: <20231216033552.3553579-1-kent.overstreet@linux.dev> References: <20231216024834.3510073-1-kent.overstreet@linux.dev> <20231216033552.3553579-1-kent.overstreet@linux.dev> Precedence: bulk X-Mailing-List: linux-fsdevel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Migadu-Flow: FLOW_OUT by moving cond_resched_rcu() to rcupdate.h, we can kill another big sched.h dependency. Signed-off-by: Kent Overstreet Reported-by: noreply@ellerman.id.au Acked-by: Geert Uytterhoeven --- include/linux/rcupdate.h | 11 +++++++++++ include/linux/sched.h | 13 +++---------- 2 files changed, 14 insertions(+), 10 deletions(-) diff --git a/include/linux/rcupdate.h b/include/linux/rcupdate.h index f7206b2623c9..8ebfa57e0164 100644 --- a/include/linux/rcupdate.h +++ b/include/linux/rcupdate.h @@ -1058,4 +1058,15 @@ extern int rcu_normal; DEFINE_LOCK_GUARD_0(rcu, rcu_read_lock(), rcu_read_unlock()) +#if defined(CONFIG_DEBUG_ATOMIC_SLEEP) || !defined(CONFIG_PREEMPT_RCU) +#define cond_resched_rcu() \ +do { \ + rcu_read_unlock(); \ + cond_resched(); \ + rcu_read_lock(); \ +} while (0) +#else +#define cond_resched_rcu() +#endif + #endif /* __LINUX_RCUPDATE_H */ diff --git a/include/linux/sched.h b/include/linux/sched.h index d528057c99e4..b781ac7e0a02 100644 --- a/include/linux/sched.h +++ b/include/linux/sched.h @@ -10,8 +10,11 @@ #include #include +#include +#include #include +#include #include #include #include @@ -22,7 +25,6 @@ #include #include #include -#include #include #include #include @@ -2058,15 +2060,6 @@ extern int __cond_resched_rwlock_write(rwlock_t *lock); __cond_resched_rwlock_write(lock); \ }) -static inline void cond_resched_rcu(void) -{ -#if defined(CONFIG_DEBUG_ATOMIC_SLEEP) || !defined(CONFIG_PREEMPT_RCU) - rcu_read_unlock(); - cond_resched(); - rcu_read_lock(); -#endif -} - #ifdef CONFIG_PREEMPT_DYNAMIC extern bool preempt_model_none(void);