From patchwork Thu Mar 9 11:09:29 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Imran Khan X-Patchwork-Id: 6352 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp231790wrd; Thu, 9 Mar 2023 03:21:42 -0800 (PST) X-Google-Smtp-Source: AK7set/LRXqPAjcDqXwcCyIyW0u3iwZ8+h1q3YVLLG6E3RObb9oMHUMz1X3WCEyBfiyvlU/hdTi0 X-Received: by 2002:a17:903:32d2:b0:19a:7d73:ef47 with SMTP id i18-20020a17090332d200b0019a7d73ef47mr26000388plr.17.1678360902306; Thu, 09 Mar 2023 03:21:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1678360902; cv=none; d=google.com; s=arc-20160816; b=COFaALzV3MRq7dNjxPDS6mZFjObqikt1Cm+c3s/wrAkEIXuEX+OjqPc0Ca4jJ2RE8N dJ1s/zxDASiZwsJf/08PG3jlmk2E8Zn15k8AkaDnjBfYuaVt3zYAO3+Q/nettT1tSYQk 6UZ8PCD60EtWAV0orrrn0MDhfCeremrxEirv2m49pVCXyPpKR88jaZ3IQoWGFZWhTJ7X s5M1r8BWaC03IZE3Y48QU2ARVvmurPX3VJndYKZVvaPUnbI7j38TKWY/h7Igo/A2PwKJ lxZdSPsmwcodGg0SsK3rqBATbPGZh7gWFjhwj+4FU3DJm5FpT0advXlrDNydOdPlXEmQ PKpw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=rz8j261A9Wi0V/X/gjXk1TIqRxkLG+PIYby2YrHDAwk=; b=hVqu4X98VkiQhHP26m2a7w1Ui3+SYvYH63tPW848N+rfkEQ9I90tRW0dQlJbVVCFa9 ewUdx+59Br4Zskrl2Jpde6Hnj0y9j/5LBa/iXeWS9ns2A3kZB4TA/EIH/i/GD0ktvjrP fZJuXGv0XJ7Di7SgSG3C03W4p+mJlsUDD40aawMwADtP+xPPeURJMUTLTheCB7SdlIKX YzaePYnnnq/HeyctwBHVQ6B2DquQ0Rd/sqH0fYSsFHA/I5Y8qZwhhn0vSjCPot14ezm1 jqMKx/8xikiuih3m2CcGtzti5bkQnmTpxDP3NX5r9hYI4tPlCt9kALqzJLJrak7xMb3V V6IA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2022-7-12 header.b=A1kd8vcZ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id bj10-20020a170902850a00b001842f465c10si15937660plb.438.2023.03.09.03.21.26; Thu, 09 Mar 2023 03:21:42 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2022-7-12 header.b=A1kd8vcZ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231453AbjCILPY (ORCPT + 99 others); Thu, 9 Mar 2023 06:15:24 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43740 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231459AbjCILOc (ORCPT ); Thu, 9 Mar 2023 06:14:32 -0500 Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 49BFB5CEDF; Thu, 9 Mar 2023 03:09:51 -0800 (PST) Received: from pps.filterd (m0246617.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 3297eaCY029057; Thu, 9 Mar 2023 11:09:39 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : mime-version : content-transfer-encoding; s=corp-2022-7-12; bh=rz8j261A9Wi0V/X/gjXk1TIqRxkLG+PIYby2YrHDAwk=; b=A1kd8vcZKA98SyiXXMhbYgbcWley/+IlVK08p9w2F1mpCQPRbHWK4D3Pap3wYikNUoDr DbCfvL0MHVxvKUHDKCdJPiVOLM1iabibCNJWqF0017hpQuvtMKHkj50yLfu+YkNffGsq iMp4J0RnuIUxGEJ/yHcRikeizYEwK8vwdb2Y2OBCc3afasXDesYKmeOm2UMPz2sRedg5 eaiTDB8tbn8V65S8SBUp/O+NfXXCpWJW1DH2MXCWZw6TcNYiYS98GReRlU7mYPx2Ue3O MsfFkp3HVEzpU0gqk6yycpRZ2O2qx2CWHaWzI2IHKEdd9SicGKBHkXaEWUzih/A0+LYz Uw== Received: from phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta02.appoci.oracle.com [147.154.114.232]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3p416wte22-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 09 Mar 2023 11:09:39 +0000 Received: from pps.filterd (phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (8.17.1.5/8.17.1.5) with ESMTP id 329A8fAF020892; Thu, 9 Mar 2023 11:09:38 GMT Received: from pps.reinject (localhost [127.0.0.1]) by phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3p6fu9b751-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 09 Mar 2023 11:09:38 +0000 Received: from phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 329B70tI021817; Thu, 9 Mar 2023 11:09:37 GMT Received: from localhost.localdomain (dhcp-10-191-129-247.vpn.oracle.com [10.191.129.247]) by phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTP id 3p6fu9b73f-1; Thu, 09 Mar 2023 11:09:37 +0000 From: Imran Khan To: tj@kernel.org, gregkh@linuxfoundation.org, viro@zeniv.linux.org.uk, willy@infradead.org Cc: linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, joe.jin@oracle.com Subject: [PATCH v2 0/3] kernfs: Introduce separate rwsem to protect inode Date: Thu, 9 Mar 2023 22:09:29 +1100 Message-Id: <20230309110932.2889010-1-imran.f.khan@oracle.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.942,Hydra:6.0.573,FMLib:17.11.170.22 definitions=2023-03-09_06,2023-03-08_03,2023-02-09_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxlogscore=945 adultscore=0 phishscore=0 suspectscore=0 malwarescore=0 spamscore=0 bulkscore=0 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2212070000 definitions=main-2303090088 X-Proofpoint-GUID: ZY2tDRDO6Gu-9pcDu8YRtDbpwfoyj2IJ X-Proofpoint-ORIG-GUID: ZY2tDRDO6Gu-9pcDu8YRtDbpwfoyj2IJ X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1759888961380226889?= X-GMAIL-MSGID: =?utf-8?q?1759888961380226889?= Changes since v1: - Remove kernfs_rwsem from kernfs_notify_workfn - Include Matthew's "Reviewed-by" tag for Patch-3 ------------------------------------------------------------------- Original cover letter This change set is consolidating the changes discussed and/or mentioned in [1] and [2]. I have not received any feedback about any of the patches included in this change set, so I am rebasing them on current linux-next tip and bringing them all in one place. As mentioned in [1], since changing per-fs kernfs_rwsem into a hashed rwsem is not working for all scenarios, PATCH-1 here tries to address the same issue with the help of another newly introduced per-fs rwsem. PATCH-2 and PATCH-3 are basically resend of PATCH-1 and PATCH-2 respectively in [2]. It would be really helpful if I could get some feedback about this changeset so that we can reduce the kernfs_rwsem contention and make sysfs access more scalable for large-scale systems. The patches in this change set are as follows: PATCH-1: kernfs: Introduce separate rwsem to protect inode attributes. PATCH-2: kernfs: Use a per-fs rwsem to protect per-fs list of kernfs_super_info. PATCH-3: kernfs: change kernfs_rename_lock into a read-write lock. Imran Khan (3): kernfs: Introduce separate rwsem to protect inode attributes. Use a per-fs rwsem to protect per-fs list of kernfs_super_info. kernfs: change kernfs_rename_lock into a read-write lock. fs/kernfs/dir.c | 26 +++++++++++++++++--------- fs/kernfs/file.c | 2 ++ fs/kernfs/inode.c | 16 ++++++++-------- fs/kernfs/kernfs-internal.h | 2 ++ fs/kernfs/mount.c | 8 ++++---- 5 files changed, 33 insertions(+), 21 deletions(-) base-commit: 7f7a8831520f12a3cf894b0627641fad33971221 [1]:https://lore.kernel.org/all/74969b22-e0b6-30bd-a1f0-132f4b8485cf@oracle.com/ [2]:https://lore.kernel.org/all/20220810111017.2267160-1-imran.f.khan@oracle.com/ ------------------------------------------------------------------- Imran Khan (3): kernfs: Introduce separate rwsem to protect inode attributes. kernfs: Use a per-fs rwsem to protect per-fs list of kernfs_super_info. kernfs: change kernfs_rename_lock into a read-write lock. fs/kernfs/dir.c | 26 +++++++++++++++++--------- fs/kernfs/file.c | 4 ++-- fs/kernfs/inode.c | 16 ++++++++-------- fs/kernfs/kernfs-internal.h | 2 ++ fs/kernfs/mount.c | 8 ++++---- 5 files changed, 33 insertions(+), 23 deletions(-)