Received: by 2002:ab2:6309:0:b0:1fb:d597:ff75 with SMTP id s9csp240531lqt; Thu, 6 Jun 2024 02:03:56 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWlnNWbLgaa7z/ZnIPXIeQH7FFazAHs58qLz31MLQvaG9MmJ4tuqdChnzh7EWsKug65FTil+NsJuJWijnM3SC/m6kHEMnPAlZvPeis8GQ== X-Google-Smtp-Source: AGHT+IFbna9Xe+aOCa+1EIkWCR0LcNg1/EtG3HkVgRkvob8VEGgLAHOjZhmizS4F58FMpiGLO4VJ X-Received: by 2002:a17:906:1646:b0:a59:c209:3e33 with SMTP id a640c23a62f3a-a699f349b6bmr305498166b.15.1717664636399; Thu, 06 Jun 2024 02:03:56 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717664636; cv=pass; d=google.com; s=arc-20160816; b=KF9/Zg2lxf/nqNbx+cvTJA3libmtp61U+JN/Xtw+RcyM5kQvnPqTlb8F3gPby0eGxY gJ7sTfY6uwcj78/uAvZgEdlxlauGo7qcx16SeXYAITJegDs+fpas213Urs6l+MsLm9hj sviY+H/efJStSrGXn0YgG805nO+pGvscnjPysriQm41jovkSs3ETyUspeEqEwwUhetBQ ag7t4RfrkAfgkhm5p3tlrRhJQ+Ksw7Q9TCX07H3crhZVoo6ehmANINZP/dt8/GS8ZPiI BPVN9cSL+URLEc2uq8bRfpNU8x3xGhV0m9z2RILBDvNPl4S9NRc41vIZEYb0ub8qsasu kfXQ== 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:message-id:date:subject:cc:to :from:dkim-signature; bh=3LaMMkCgoD2esCAQkiWaMg4nJpbFy0zkLlRqQQ/bL3w=; fh=DSuQ2Rfe9tC2niMY8h5MUISgVbCGNGe2cdpAavb6HWA=; b=YooDugeY7Lbq7mUN0htaswaY6C2h42vVsDQ/cPsjjOP8DT0R4oGl5TJYKxtheGds3a pCA2PlmUNoVTw68seHekDrn6wSxWrHn6WfM1SRAYJBPH4YAFSyHGrIXWlcAKJXrtiGq/ P4zB5eXDjxjUP3DiavA9zLDoitBsBMoWAirR6/dqdhroZc4qIAbG4H9hnBEoDxelxplp ppUZhMip7ELglCrodsNY6qyaW3xpKMFfTz1nPhffa9czW8y4906tVmXtds2Unn5fX2nW dpW3yvGPzB028tiP/telI3oMU9WxDMB6HlVK5rCujK3Ez+PaZGnMlQpwWWvN3TIlx31p TeVA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=g91mZzVQ; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-203916-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-203916-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id a640c23a62f3a-a6c8074b8f9si48187866b.1028.2024.06.06.02.03.56 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 06 Jun 2024 02:03:56 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-203916-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=g91mZzVQ; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-203916-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-203916-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.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 am.mirrors.kernel.org (Postfix) with ESMTPS id 158201F27B4A for ; Thu, 6 Jun 2024 09:03:56 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 1066513F014; Thu, 6 Jun 2024 08:58:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="g91mZzVQ" Received: from mail-pl1-f169.google.com (mail-pl1-f169.google.com [209.85.214.169]) (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 E7CFF13C674 for ; Thu, 6 Jun 2024 08:58:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.169 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717664287; cv=none; b=EaALp+AweYWILtQVdbQ7gC/kqdAXPjRWjKcTijzlXwevr12QMASMn79cklLn38R37Z5X5LHGz9i6PwWB0Tkq1yw2TezVlMPoWWp2v1DBOUEfpyYOB7hTrvBafmcmxCEkxO8+hp0v3BmaxlEDt79mYaAhQR/xFi8iUAvS7t26gvU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717664287; c=relaxed/simple; bh=CLHwP7L0/ux9CLmz+ukY/+pvEHh7wwe2hBd2gGvLaVw=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=ZQtKKa5YeIWnHtY86nIheWX+y+VPL9/Z+525tJLDP2vhzRKqPxG3j/PLQBQupVcmtj39hmcXgle2iPoXU7sFyX8sdqwrF0ETT8R0BLrT1Ua587hm3xdh0xHytDNpPFHPgdgkoLveax5HUYmvxAP1COeM2J2GH0JZYdvgeZTYtkc= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=g91mZzVQ; arc=none smtp.client-ip=209.85.214.169 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-pl1-f169.google.com with SMTP id d9443c01a7336-1f63642ab8aso6733665ad.3 for ; Thu, 06 Jun 2024 01:58:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1717664285; x=1718269085; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=3LaMMkCgoD2esCAQkiWaMg4nJpbFy0zkLlRqQQ/bL3w=; b=g91mZzVQguOCQOO/o8/dh7fps2hj68fn84HB9FJRooG8etfU0xInaabu0GpC5oPxZc rwIvecPDiSnAg0Irpyo/KuOxYcuiQlNsyo1OKPx2sUIXTkW7PnvuB2HVjPHWyC7Uu0p1 nMy0V1k0YOOujf2TYkiwiquQssLJYmgHZjcBU2eBGzyXfgbxxzjZ4uKOUULrtTaas7IN fmokNnXKlWwO61HQtF+J0WEFxIs+Bye5FH1xERduomE+34nje4g6SiP7cxPjPje6IdKX vbKey8f5bE1OJCxZ/EjQpn9RLS5nnwFBTFvAQi87aHFMRygGOhYN4s4XPSkhJPIgbr63 azmg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717664285; x=1718269085; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=3LaMMkCgoD2esCAQkiWaMg4nJpbFy0zkLlRqQQ/bL3w=; b=OlBpJxdHOtCBplPvZCeEzWkg6293dF7sfmPHMDHHyIUx/gd2hV84fTT6+UcxvyZRgv y5yPH9fmHdFQbTL5R9tp9SHBSjZRapI8fp0YRJ6+QDwMuMIZ9JW2R1CLXzqgf7dKWeaP e6Gxfp7Ka2T3PiTbYkGzZkaxhw9aPGTb710QtKptfIDJf2oXb2uLA9X+cNjllc7MkkQU Q6bb/UWlBYgSsuACx0S7x6qoQqTmymfnhfDvKX0MEkS++skMBTE7bYXAsKPs1QwP0+CB rII3R9/FsKOnilqPgSdC/wB6GXvASEWIQWKEyRY8CUTJ6xOlSJtyd+gk27vEz3s32SgV sT1A== X-Forwarded-Encrypted: i=1; AJvYcCV9U5rnQfYE3PmbKKVZ4n5lc1Jj2R8O+OLkh+x+6GrcSTf+P+j5lILX1HWMuHS7SZqcWljWh3Ox5VkAORLYRr1Ih6OUGhDR6gM0YC/f X-Gm-Message-State: AOJu0YwR7SPgcZrcKl39Uci27a2MeLhtedpKW+KpSjJBycOVKmzUVx/r wg2U6czY8EK9goCNHxQ4hhZfsNLhRbFwLSjyhQbhwQtFK3fb8cuw X-Received: by 2002:a17:902:f549:b0:1f4:5278:5c19 with SMTP id d9443c01a7336-1f6a5a5ca41mr53823725ad.49.1717664284995; Thu, 06 Jun 2024 01:58:04 -0700 (PDT) Received: from localhost (97.64.23.41.16clouds.com. [97.64.23.41]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-1f6bd75f0e2sm9580805ad.5.2024.06.06.01.58.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 06 Jun 2024 01:58:04 -0700 (PDT) From: Wenchao Hao To: Peter Zijlstra , Ingo Molnar , Will Deacon , Waiman Long , Boqun Feng , linux-kernel@vger.kernel.org Cc: Wenchao Hao Subject: [PATCH] lockdep: make class_filter() inline and remove unnecessary macros Date: Thu, 6 Jun 2024 16:57:44 +0800 Message-Id: <20240606085744.3475629-1-haowenchao22@gmail.com> X-Mailer: git-send-email 2.38.1 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit This is just a clean code which simplify the code implement and make it easy to understand. No logic changed from origin implement. Make class_filter() inline which just return 0, and directly called from verbose(), very_verbose(), HARDIRQ_verbose() and SOFTIRQ_verbose() without macro control, remove unnecessary macros VERY_VERBOSE, HARDIRQ_VERBOSE and SOFTIRQ_VERBOSE. Signed-off-by: Wenchao Hao --- kernel/locking/lockdep.c | 25 +------------------------ 1 file changed, 1 insertion(+), 24 deletions(-) diff --git a/kernel/locking/lockdep.c b/kernel/locking/lockdep.c index 151bd3de5936..cd8356106da2 100644 --- a/kernel/locking/lockdep.c +++ b/kernel/locking/lockdep.c @@ -478,21 +478,11 @@ void lockdep_set_selftest_task(struct task_struct *task) */ #define VERBOSE 0 -#define VERY_VERBOSE 0 -#if VERBOSE -# define HARDIRQ_VERBOSE 1 -# define SOFTIRQ_VERBOSE 1 -#else -# define HARDIRQ_VERBOSE 0 -# define SOFTIRQ_VERBOSE 0 -#endif - -#if VERBOSE || HARDIRQ_VERBOSE || SOFTIRQ_VERBOSE /* * Quick filtering for interesting events: */ -static int class_filter(struct lock_class *class) +static inline int class_filter(struct lock_class *class) { #if 0 /* Example */ @@ -506,14 +496,10 @@ static int class_filter(struct lock_class *class) /* Filter everything else. 1 would be to allow everything else */ return 0; } -#endif static int verbose(struct lock_class *class) { -#if VERBOSE return class_filter(class); -#endif - return 0; } static void print_lockdep_off(const char *bug_msg) @@ -809,10 +795,7 @@ static void print_kernel_ident(void) static int very_verbose(struct lock_class *class) { -#if VERY_VERBOSE return class_filter(class); -#endif - return 0; } /* @@ -4171,18 +4154,12 @@ void print_irqtrace_events(struct task_struct *curr) static int HARDIRQ_verbose(struct lock_class *class) { -#if HARDIRQ_VERBOSE return class_filter(class); -#endif - return 0; } static int SOFTIRQ_verbose(struct lock_class *class) { -#if SOFTIRQ_VERBOSE return class_filter(class); -#endif - return 0; } static int (*state_verbose_f[])(struct lock_class *class) = { -- 2.38.1