Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp2430598pxu; Mon, 14 Dec 2020 02:03:05 -0800 (PST) X-Google-Smtp-Source: ABdhPJwDXbWfsgChI8Cd5GUVO5I88o3sXnWeMMQwRpF/3jf+H9GjSXa1Jvox1+W3Yj3O6QtS05AF X-Received: by 2002:a05:6402:14c5:: with SMTP id f5mr23292310edx.232.1607940185469; Mon, 14 Dec 2020 02:03:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1607940185; cv=none; d=google.com; s=arc-20160816; b=inbwcXXq687X9Z5UqWn0Y1mXSBCQQJ1QliOJpJNT6ABFziY1hDWKn6CYZlwmr9tUbP bHAkb0+RIgl3QGx7pNLQxTIWftSHWsMK41Gji2BC9LzLE85mTlKUWDCOVVy8VnzF2Wgl IfEzhReZ/Hia40LsxNoB4MWTr/whVGS3Xt8Lw4LNndYr7xPtxp8iMSBfPwmFmQTXWh6f C1csWT2A9kIoch8jlRQbEcrJcC1rFrFpSp1GDM01PKkY6/ZKbgvE80xPGuNwtHG6OrYI JlMpcOfl38wz0d7dDnvAIaCcrYjWnVmiHLBL0cQvycwrcMSNwCokIRAExjj2A1Rdh9fu jIRg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=JobrGTEzBRmqVBYkQ9rl3c0W2zJKqOwF2tb7YZ5F2Ws=; b=kJ2Sj8ENoQ3yDVVqbEfthHlqwbZLlJxmAWi0MzmrLCL0kSyeN6ZNtVeMH2G7WMtXqt 3ZlWwEfhOgbQLSa/QiUzYJmy26UHboz1LcvogB6gEPGo1/KK5GTEMssZ2fmJbD3hnOo/ HgyoCiecEC0oin+YXpblCU3lfXdUogFDbDnvz6sQdiemQvke7JiTieqjZirENXHnKtqW exkeJeMRs7bf5wOsCvZAHOyYK7KP47FtZFSvfj5b4HbVmS8PtJRFgVzNNfwOmVELc1GH mVPSKT25oZ2PkiHG2hKXSiix7s2waJ6FPyb2iI+jmnhxjYiT7nZE828DcjcRWwGB/PGb PHCw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=fn5ABMsV; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id i17si10073308ejk.401.2020.12.14.02.02.42; Mon, 14 Dec 2020 02:03:05 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=fn5ABMsV; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2404657AbgLNGPJ (ORCPT + 99 others); Mon, 14 Dec 2020 01:15:09 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53600 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726389AbgLNGPJ (ORCPT ); Mon, 14 Dec 2020 01:15:09 -0500 Received: from mail-lf1-x142.google.com (mail-lf1-x142.google.com [IPv6:2a00:1450:4864:20::142]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7FC85C0613CF; Sun, 13 Dec 2020 22:14:28 -0800 (PST) Received: by mail-lf1-x142.google.com with SMTP id a9so27229738lfh.2; Sun, 13 Dec 2020 22:14:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=JobrGTEzBRmqVBYkQ9rl3c0W2zJKqOwF2tb7YZ5F2Ws=; b=fn5ABMsVh9L+dBtfL52XkQ71KyhxPPAvO5sGIuui0uHPTxh8V6oo5p+lbJVf5xbk3K sV6uzbAWLwRxsxpM05aVz3PYt44B1b5Ri8zgWtzKmD/3PSrXpQwO3/VnpLFguf2QG+ot a0XXmNJNEXUPkgTWWQa2DfA5sfk+5SXg1VnE5ZPmUIzhIl3XPMvabWIRhqB5twWWJe+V ZlqavXHsA0DWWuS2joTf/S+RVYc59trRQqaGzvPswBzbCoD0ZX1Iaf0PdTvaEaY4zmdP Yx9VWbEjj4QyM83jSy9H5nJgyNB0aQqxCLRgAe2LJrJKXKuKxS6kE4E4lFS0aZDOPlcX Ec/A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=JobrGTEzBRmqVBYkQ9rl3c0W2zJKqOwF2tb7YZ5F2Ws=; b=E/VyUcHq8zjuccj+cf25ItaJGN6IcueNlpJovyIUjFDTccEkIfrQaBrjIxyrMI6tRV PfpTm/SRpRXa5sUTDVlV2jat8yPl4kSRDYAeYs04KkAFgEt2AOOe1FInBF7B+FXaLdt3 7MT3RFY4lbkTuT6cBcitnz7D2r1h9PfeFXmVuZ/D7Zo/HrjIbbAH8BUU8cWd3G9/a0tl lhDJ/4Vst2lW4jsihbMn6z4qrO0baDaI+CFwYL1KXQJqfAFLr08GYCOI5xLVoQsCtXMr LwCBELNvE51RT4YAWbwiDMryx5xMIsbX3YjoP23jqQUO5jdUYBQnjBvPWiPQGoCBuYCL IMYw== X-Gm-Message-State: AOAM532FoF7N4xAyMEe77N7W6GeSkM6HvZbVPPHnTBgLJH1p4aBd0W8/ SxNt0UHxGlz+wgQyEeGu396WYzNGvx4aZh91jkc= X-Received: by 2002:a2e:2202:: with SMTP id i2mr7243263lji.306.1607926466829; Sun, 13 Dec 2020 22:14:26 -0800 (PST) MIME-Version: 1.0 References: <159237905950.89469.6559073274338175600.stgit@mickey.themaw.net> <20201210164423.9084-1-foxhlchen@gmail.com> <822f02508d495ee7398450774eb13e5116ec82ac.camel@themaw.net> <13e21e4c9a5841243c8d130cf9324f6cfc4dc2e1.camel@themaw.net> In-Reply-To: From: Fox Chen Date: Mon, 14 Dec 2020 14:14:13 +0800 Message-ID: Subject: Re: [PATCH v2 0/6] kernfs: proposed locking and concurrency improvement To: Ian Kent Cc: akpm@linux-foundation.org, dhowells@redhat.com, Greg KH , linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, miklos@szeredi.hu, ricklind@linux.vnet.ibm.com, sfr@canb.auug.org.au, Tejun Heo , viro@zeniv.linux.org.uk Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, Dec 13, 2020 at 11:46 AM Ian Kent wrote: > > On Fri, 2020-12-11 at 10:17 +0800, Ian Kent wrote: > > On Fri, 2020-12-11 at 10:01 +0800, Ian Kent wrote: > > > > For the patches, there is a mutex_lock in kn->attr_mutex, as > > > > Tejun > > > > mentioned here > > > > (https://lore.kernel.org/lkml/X8fe0cmu+aq1gi7O@mtj.duckdns.org/), > > > > maybe a global > > > > rwsem for kn->iattr will be better?? > > > > > > I wasn't sure about that, IIRC a spin lock could be used around the > > > initial check and checked again at the end which would probably > > > have > > > been much faster but much less conservative and a bit more ugly so > > > I just went the conservative path since there was so much change > > > already. > > > > Sorry, I hadn't looked at Tejun's reply yet and TBH didn't remember > > it. > > > > Based on what Tejun said it sounds like that needs work. > > Those attribute handling patches were meant to allow taking the rw > sem read lock instead of the write lock for kernfs_refresh_inode() > updates, with the added locking to protect the inode attributes > update since it's called from the VFS both with and without the > inode lock. Oh, understood. I was asking also because lock on kn->attr_mutex drags concurrent performance. > Looking around it looks like kernfs_iattrs() is called from multiple > places without a node database lock at all. > > I'm thinking that, to keep my proposed change straight forward > and on topic, I should just leave kernfs_refresh_inode() taking > the node db write lock for now and consider the attributes handling > as a separate change. Once that's done we could reconsider what's > needed to use the node db read lock in kernfs_refresh_inode(). You meant taking write lock of kernfs_rwsem for kernfs_refresh_inode()?? It may be a lot slower in my benchmark, let me test it. > It will reduce the effectiveness of the series but it would make > this change much more complicated, and is somewhat off-topic, and > could hamper the chances of reviewers spotting problem with it. > > Ian > thanks, fox