Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp2024664pxu; Sun, 13 Dec 2020 10:58:47 -0800 (PST) X-Google-Smtp-Source: ABdhPJwm5gLwjXXFW+7sDV72s+qhXTVifsmCU4qoAxNCdr3nOvR0bT2mfEMRj13q6Vf8PKS1yC03 X-Received: by 2002:a17:906:ceca:: with SMTP id si10mr19516034ejb.547.1607885927280; Sun, 13 Dec 2020 10:58:47 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1607885927; cv=none; d=google.com; s=arc-20160816; b=ulVDNpBBI2pAzeD4go91RsrkEXJk/AAZcwXFCiwuG+UpBwIdFuVonoCAZ2RiY7QQfF oB+D8L88aGobIPPSu3jHS1do+9aPamO4lYwnp0e3akono6MwMt7JJgBiaoIMm7TcE4GG e84v0V0bJL0KIsajxktxazFOLy+KdNdOXoGRBeo67k5i6sO6QHLemQT8JFW4jVk53Ela dEDw06zG9KLyU+yg3ZKsqHnotD5WSFQC3J0fCh9EMSUlKxZ/oadPOR0YQUzfWHKL+HBH hPuBld/AYNyla7cWKY7I49FKLl2A8EvmFDWuipeRX35mhVKa1GyvLIJJiIApz5Mf1NYm wiRg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=sCN3Anbx+iYXLIlE4A4UXTtS9kAtcNY8aLxN+VneAf8=; b=aFwE2ohDkyTSYC081/8tiLNQVXioIQco6TVSBeKCHj7rVkKSupAfWOEKRq8JY5v58l Wc3S4otcBAIZ6YHPiFr3C6/vd9+EV4hMK2S0asit3XFC3RqeuF1SagraUwVUIRcdA4rK JgBUGUpkZzpb2brW+/8WwGF6gM3SQQ28w+GmAyO/oe/yNDqO642D8iq9Yv36YG277gDl 6RLhG3E2kaXlF74Tq5q9Ad9g3z+JFO2cpo3LHHYs3gB+2yomnYq0GTQSAoyw0nIxbWDS /6OTeUi7gnp5r3jMqxiQnlR5IzcfFxcKSJLu86vpN1m4jOP8iL8ewUjSRsr3jle63+7M beZw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=I3BbV0LS; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id i8si8761043edr.271.2020.12.13.10.58.24; Sun, 13 Dec 2020 10:58:47 -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=@infradead.org header.s=casper.20170209 header.b=I3BbV0LS; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2391124AbgLMQdo (ORCPT + 99 others); Sun, 13 Dec 2020 11:33:44 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40952 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2436880AbgLMQdV (ORCPT ); Sun, 13 Dec 2020 11:33:21 -0500 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6F35CC0613CF; Sun, 13 Dec 2020 08:32:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=sCN3Anbx+iYXLIlE4A4UXTtS9kAtcNY8aLxN+VneAf8=; b=I3BbV0LSx7uI2niy5L1Su8dLD0 i5YBup/v+QJYhopBj+HcOxL44MnIcBtzJIyRBhqk4aeT+r+jgb1F4i9aAwVMesN1PQbbGZiVpkNz7 oHITJBL/WSkVs7xF6Q/NuuG0zxmZZjRnwb/L93fruFuwQ4clJmU/9SGdp+jY06HO+GVOHinPJqTed BvqY2ppmvKLmvuQrmWMzBKyj8qEKBrfL4LMXFD7CDj0eYKxSES5pYhrB1x+H35279h+agrv4UTA+t Om4qw96P4IIDHimr0Gv2qC3I/hvvMjcbd8sZzPY+1FU1oBKabGIA2G+PcFM1DTY8+uMJJABbexYUS oQjqtF5Q==; Received: from willy by casper.infradead.org with local (Exim 4.92.3 #3 (Red Hat Linux)) id 1koUIU-0004KX-5T; Sun, 13 Dec 2020 16:32:34 +0000 Date: Sun, 13 Dec 2020 16:32:34 +0000 From: Matthew Wilcox To: "Eric W. Biederman" Cc: Stephen Brennan , Alexey Dobriyan , James Morris , "Serge E. Hallyn" , linux-security-module@vger.kernel.org, Paul Moore , Stephen Smalley , Eric Paris , selinux@vger.kernel.org, Casey Schaufler , Alexander Viro , linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v2] proc: Allow pid_revalidate() during LOOKUP_RCU Message-ID: <20201213163234.GH2443@casper.infradead.org> References: <20201204000212.773032-1-stephen.s.brennan@oracle.com> <87tusplqwf.fsf@x220.int.ebiederm.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <87tusplqwf.fsf@x220.int.ebiederm.org> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, Dec 13, 2020 at 08:30:40AM -0600, Eric W. Biederman wrote: > Stephen Brennan writes: > > > The pid_revalidate() function requires dropping from RCU into REF lookup > > mode. When many threads are resolving paths within /proc in parallel, > > this can result in heavy spinlock contention as each thread tries to > > grab a reference to the /proc dentry lock (and drop it shortly > > thereafter). > > I am feeling dense at the moment. Which lock specifically are you > referring to? The only locks I can thinking of are sleeping locks, > not spinlocks. Stephen may have a better answer than this, but our mutex implementation spins if the owner is still running, so he may have misspoken slightly. He's testing on a giant system with hundreds of CPUs, so a mutex is going to behave like a spinlock for him. > Why do we need to test flags here at all? > Why can't the code simply take an rcu_read_lock unconditionally and just > pass flags into do_pid_update_inode? Hah! I was thinking about that possibility this morning, and I was going to ask you that question.