From patchwork Wed Jan 31 14:50:06 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Max Kellermann X-Patchwork-Id: 194820 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:2087:b0:106:209c:c626 with SMTP id gs7csp1967949dyb; Wed, 31 Jan 2024 07:32:11 -0800 (PST) X-Google-Smtp-Source: AGHT+IGmz71YjUEbFcS8s1/sVN0IGDW0DjMMCUQoBxIY+WElBFJ8Z9RFnmM+Q1Gp5A6EvMjwvDXr X-Received: by 2002:a05:6358:6e95:b0:176:9bfd:d08d with SMTP id q21-20020a0563586e9500b001769bfdd08dmr1838257rwm.11.1706715130747; Wed, 31 Jan 2024 07:32:10 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706715130; cv=pass; d=google.com; s=arc-20160816; b=0jTnRIJIdMGXhh/Qn4WqaKE7LBc0WfEW68MTmH0e+IFw9IHIv+NdG+eKqS/UuJcnMW EXhMOoM8LKQpFoJIoQmH/uJrK5Y04QZBRaZJWczj0xVOG/dM0ybgG90sUGsx2pKc4ECC eyF2Ccd7MuEGRNqyyhE95oi4vHWDy31tlg0nCcyAqWcQsB+Uqd9fEY9tW5g3PASmwXnd MWlc6hgGKF7JDxJtj5WBJI3omQcAP1tx5rszFu0U3ke/E8udNwWxyqOokWoc5Vai0wsA jDdVvle5NQ9vRetQNVqxOWcYLNqrOjBEHJY8n6KSDSIENsqOeXJzEw/nATy5lctBMF/H G2vg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=ocDV0xt8N038gP+DLg6dR5T/0PL4+pEI/kg00OQd02E=; fh=qEdZGnpiBmb46OaZRPFMCdQku5aH+26GKluxykWeCpc=; b=pXYBuQQ6aqVFc7ve55EGLaFzMMVKiRMbNF/x59ObEAkg06JzydcgvolS2bCdvMwSFY ioiDuzYOdp4RcGyCdXF0xTTKzbkSmtuTJXl3wP7FkmVJUSg45FAS8JfJL/A3+9yaRtNd f6MdlwpCFLiXBtB8KJ/xEtaVsiS1VG2VKXutL8jw+2TdV6rAYfju61Y7LnrIa+zNliOF B7A34Y/vgEpQZ1G6UdhmGX4Ih5CaeWU03JmqIKGTQ8m7EDa+k4YgLHvxp2mmO75IDN0N 5etQg6icLVV41PULJEcWRmSSfdJAVPbOYCCQGyGVyuQKn8RruofKGXrNqlkaMAWfKjq/ 0fYA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@ionos.com header.s=google header.b=Qdk5gU19; arc=pass (i=1 spf=pass spfdomain=ionos.com dkim=pass dkdomain=ionos.com dmarc=pass fromdomain=ionos.com); spf=pass (google.com: domain of linux-kernel+bounces-46660-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-46660-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=ionos.com X-Forwarded-Encrypted: i=1; AJvYcCUbGvoDIM9VBj0mffOsxN1t79qXzzS/TMAV2+IdYRy8nF5QLbhuV75kHMvGef7IIsd/SGfEPw52M9+fw0onSzdOpJI2ww== Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id 79-20020a630152000000b00585999a38a6si9641820pgb.793.2024.01.31.07.32.10 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 31 Jan 2024 07:32:10 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-46660-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@ionos.com header.s=google header.b=Qdk5gU19; arc=pass (i=1 spf=pass spfdomain=ionos.com dkim=pass dkdomain=ionos.com dmarc=pass fromdomain=ionos.com); spf=pass (google.com: domain of linux-kernel+bounces-46660-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-46660-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=ionos.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id B648EB2D75D for ; Wed, 31 Jan 2024 14:58:31 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id B511E13DBBE; Wed, 31 Jan 2024 14:51:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ionos.com header.i=@ionos.com header.b="Qdk5gU19" Received: from mail-wr1-f45.google.com (mail-wr1-f45.google.com [209.85.221.45]) (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 B9F0012CDA9 for ; Wed, 31 Jan 2024 14:50:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.45 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706712649; cv=none; b=BmN1/jbuwkb2HB3C5GAmDW9no+vfK56oTsohaX4t74hRyEBQNlFeZ0Dkn3cAAMgOMBNfWqy8VNE+VFgQAR4doOhBwJbWW5lfR1zP2Y/s9D6Fr90qHkR/vudcO0jSD7FhkzUd6EbCHMZX1acOQynZ9Ga1x3eQDg3OVFOzvRtjHXw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706712649; c=relaxed/simple; bh=k0CWYvaaB/gYg4+a4TXJ9LeyRASwAqQNiIxSmINjJE8=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=GjULeREby4UCzDCyuBNHgjTbUH3GByA3Sr2ZWH9oZnJGM87UrcnBhyxQqtDj04JNTJqt0i9T4or3JE69QX6/vFpLBMGiooUjVcU9cupl4ThcK6p+Qq6JFJ6UAgH5ZEqh8ESj/J2lZYMXcw4eXx6jdzttrXziC5Sh8LRFyVmZmzA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=ionos.com; spf=pass smtp.mailfrom=ionos.com; dkim=pass (2048-bit key) header.d=ionos.com header.i=@ionos.com header.b=Qdk5gU19; arc=none smtp.client-ip=209.85.221.45 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=ionos.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ionos.com Received: by mail-wr1-f45.google.com with SMTP id ffacd0b85a97d-33b01484cd7so685211f8f.0 for ; Wed, 31 Jan 2024 06:50:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ionos.com; s=google; t=1706712637; x=1707317437; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=ocDV0xt8N038gP+DLg6dR5T/0PL4+pEI/kg00OQd02E=; b=Qdk5gU19rqACw5ykNFC6HMcct2v76SnWMBc53AYy4R9XzvO3O0bhVaASl3UTg+y24v P3RCMRzqjftx08lg6eNNxbu9hFA9UWjMeCwMLCqQMGPWdFcSfcFkFvTGFK0gs84gDSZ7 9U83AwlAw8Or8vbebdZIkwazfM9nbLYbGK4URDnpTeZmzLVHJ7NXty7mh1omZ9yrGhI5 fiZJYHV5hy8cQUL95pFtllGaeFk0GdKGDgmMrGw0Yf+jtNfHZDHF8OItIuEj/TWjOPSB Q1zJt1tECl9Zu7rvmyFWfL9vFnrI7us/esejUzk00JAHHBsBAn27L2rOBQ8JnjZ9su17 RyWQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706712637; x=1707317437; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=ocDV0xt8N038gP+DLg6dR5T/0PL4+pEI/kg00OQd02E=; b=gsj4lyUKRlbRDSaIHQyrkdmAH6zsPsqM+RCzC5guciCYFPXuPuzDXV0rDrdAam4tqn 3pyn4O6bMWsBFTEKwvQjN2DAHMka6oROfMZ6sCylJq5cSOFz+6TGOnYeMnyjXOfFPomW zjetQrnsbQ3+jgQP3RlZ3F6djC5Fa1ss0luPMeslcOS2NheEaM5v2mVEXyclsJXTZl0N 5wtxRh27ePitbvEdG6jq554ze/k09eD0zs+F4QZA2RVFjdNYUJy9j3dB2q4WwDg9WqC7 PQde0Chv4CmAU/pV7jJ3dYeoehKc+hno3LosfZHf1Tl7s0uFsMTL8R6fVFlUucHgpcp6 eaMA== X-Gm-Message-State: AOJu0YwuPUmT9wY0rBJooAZhHdUkbthQ6YrQpvJiI/iS0cRu1IjQQdPh W/qfkemHOo6SrLUBxoQZ9c/SOvzJGMJYg+kZ1CTpQzWA3iJbF0O28VN7f58f/k0G4aBXT5peF/s 3 X-Received: by 2002:adf:b313:0:b0:33b:32b:92a2 with SMTP id j19-20020adfb313000000b0033b032b92a2mr1089820wrd.68.1706712636925; Wed, 31 Jan 2024 06:50:36 -0800 (PST) Received: from raven.blarg.de (p200300dc6f2f5c00023064fffe740809.dip0.t-ipconnect.de. [2003:dc:6f2f:5c00:230:64ff:fe74:809]) by smtp.gmail.com with ESMTPSA id ch15-20020a5d5d0f000000b0033905a60689sm13850173wrb.45.2024.01.31.06.50.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 31 Jan 2024 06:50:36 -0800 (PST) From: Max Kellermann To: linux-kernel@vger.kernel.org Cc: Max Kellermann Subject: [PATCH 26/28] percpu-rwsem.h: move declarations to percpu-rwsem_types.h Date: Wed, 31 Jan 2024 15:50:06 +0100 Message-Id: <20240131145008.1345531-27-max.kellermann@ionos.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240131145008.1345531-1-max.kellermann@ionos.com> References: <20240131145008.1345531-1-max.kellermann@ionos.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1789620524991275739 X-GMAIL-MSGID: 1789620524991275739 By providing declarations in a lean header, we can reduce header dependencies. Signed-off-by: Max Kellermann --- include/linux/cgroup-defs.h | 2 +- include/linux/percpu-rwsem.h | 15 +-------------- include/linux/percpu-rwsem_types.h | 24 ++++++++++++++++++++++++ 3 files changed, 26 insertions(+), 15 deletions(-) create mode 100644 include/linux/percpu-rwsem_types.h diff --git a/include/linux/cgroup-defs.h b/include/linux/cgroup-defs.h index 878deefba0e1..691c50aeafae 100644 --- a/include/linux/cgroup-defs.h +++ b/include/linux/cgroup-defs.h @@ -16,7 +16,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/include/linux/percpu-rwsem.h b/include/linux/percpu-rwsem.h index 36b942b67b7d..0f427bd5217a 100644 --- a/include/linux/percpu-rwsem.h +++ b/include/linux/percpu-rwsem.h @@ -2,24 +2,11 @@ #ifndef _LINUX_PERCPU_RWSEM_H #define _LINUX_PERCPU_RWSEM_H +#include #include #include -#include -#include -#include #include -struct percpu_rw_semaphore { - struct rcu_sync rss; - unsigned int __percpu *read_count; - struct rcuwait writer; - wait_queue_head_t waiters; - atomic_t block; -#ifdef CONFIG_DEBUG_LOCK_ALLOC - struct lockdep_map dep_map; -#endif -}; - #ifdef CONFIG_DEBUG_LOCK_ALLOC #define __PERCPU_RWSEM_DEP_MAP_INIT(lockname) .dep_map = { .name = #lockname }, #else diff --git a/include/linux/percpu-rwsem_types.h b/include/linux/percpu-rwsem_types.h new file mode 100644 index 000000000000..0716d08b758b --- /dev/null +++ b/include/linux/percpu-rwsem_types.h @@ -0,0 +1,24 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#ifndef _LINUX_PERCPU_RWSEM_TYPES_H +#define _LINUX_PERCPU_RWSEM_TYPES_H + +#include +#include +#include +#include +#ifdef CONFIG_DEBUG_LOCK_ALLOC +#include +#endif + +struct percpu_rw_semaphore { + struct rcu_sync rss; + unsigned int __percpu *read_count; + struct rcuwait writer; + wait_queue_head_t waiters; + atomic_t block; +#ifdef CONFIG_DEBUG_LOCK_ALLOC + struct lockdep_map dep_map; +#endif +}; + +#endif