From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (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 2D5C33EBF32 for ; Fri, 6 Feb 2026 20:19:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.133.124 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770409193; cv=none; b=YvnCKKWLVr5wdfU25SfmjnxQcRp7pd4v+rMTn4bkpppGLrF8mcDZMUaU2pr/XOvYw3eboXNeJArGoFUbVTovx7Z+VEDvjyB6nSorXd5j3StlyLuQeoup8F5Adly6OR6INu55NdP/D3NryNIEJkFsQyzfq+1fQkntzZAv3fWHnTo= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770409193; c=relaxed/simple; bh=mzuI1FMO7QtuIRQ5U3mqDpk3IW3+dfzY829HS5JEBec=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version:content-type; b=XpOluOrebKiZ+R+kMsBTN9ET+rFQ3lttzrZmTpMsmS62hqeXHqRRGQpIAixjcrwB31ejSh5EEglKHvSEhFaIq5m1wMPKRNqZgQ4zShr4OQEjh1jeqXbziOIFx6ekAt0s912BHKfDeAbHduZfeKpeDDjz8Kel+nHOzityAe2CsdU= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=GW/BwebW; arc=none smtp.client-ip=170.10.133.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="GW/BwebW" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1770409192; h=from:from: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; bh=Ly2nA8ZJ0dJIvsrFKrjSkM+A6/05aZpz+ZyV0YXxmwQ=; b=GW/BwebWT9pTE92Rj2b5dR7qG1I3PXkHIrOsZkmwZ4CHHy3JPRFuICPpIHJoMvma8RWDgY NHl8Yh4Zs1kvCLZMbCRfLHFJUBs+8V28Lja3oVPOepPhkEkKafLLBgB0/Q/e1pK5P158Tg E06HU2kMOJpuFXAH+f6uK4Ww/3/0CKs= Received: from mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-122-FWAjXDTkP2quftlAGNLGuA-1; Fri, 06 Feb 2026 15:19:49 -0500 X-MC-Unique: FWAjXDTkP2quftlAGNLGuA-1 X-Mimecast-MFC-AGG-ID: FWAjXDTkP2quftlAGNLGuA_1770409188 Received: from mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.111]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id EA6371800451; Fri, 6 Feb 2026 20:19:47 +0000 (UTC) Received: from llong-thinkpadp16vgen1.westford.csb (unknown [10.22.90.86]) by mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id B7B6418003F6; Fri, 6 Feb 2026 20:19:45 +0000 (UTC) From: Waiman Long To: Paul Moore , Eric Paris , Christian Brauner , Al Viro Cc: linux-kernel@vger.kernel.org, audit@vger.kernel.org, Richard Guy Briggs , Ricardo Robaina , Waiman Long Subject: [PATCH v3 0/2] fs, audit: Avoid excessive dput/dget in audit_context setup and reset paths Date: Fri, 6 Feb 2026 15:19:15 -0500 Message-ID: <20260206201918.1988344-1-longman@redhat.com> Precedence: bulk X-Mailing-List: audit@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.111 X-Mimecast-MFC-PROC-ID: jY2LDTD05r9_BiSYKscDwyxHlDz8L6BpBW0RDO4oP6k_1770409188 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: 8bit content-type: text/plain; charset="US-ASCII"; x-default=true v3: - Add a new counter in fs_struct to track # of additional references to pwd and add a new get_fs_pwd_pool() and put_fs_pwd_pool helpers to use the new counter. - Make audit use the new helpers instead of storing pwd reference internally. v2: https://lore.kernel.org/lkml/20260203194433.1738162-1-longman@redhat.com/ When the audit subsystem is enabled, it can do a lot of get_fs_pwd() calls to get references to fs->pwd and then releasing those references back with path_put() later. That may cause a lot of spinlock contention on a single pwd's dentry lock because of the constant changes to the reference count when there are many processes on the same working directory actively doing open/close system calls. This can cause noticeable performance regresssion when compared with the case where the audit subsystem is turned off especially on systems with a lot of CPUs which is becoming more common these days. This patch series aim to avoid this type of performance regression caused by audit by adding a new set of fs_struct helpers to reduce unncessary path_get() and path_put() calls and the audit code is modified to use these new helpers. Waiman Long (2): fs: Add a pool of extra fs->pwd references to fs_struct audit: Use the new {get,put}_fs_pwd_pool() APIs to get/put pwd references fs/fs_struct.c | 26 +++++++++++++++++++++----- fs/namespace.c | 8 ++++++++ include/linux/fs_struct.h | 30 +++++++++++++++++++++++++++++- kernel/auditsc.c | 7 +++++-- 4 files changed, 63 insertions(+), 8 deletions(-) -- 2.52.0