Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp2767781pxa; Mon, 17 Aug 2020 19:24:01 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzO+ev+rwcGa5PTh/aiSr30kGVEX98XM3bFc5EH2frGU4FvELS2UO5MHtdaJNovRWGwSmzi X-Received: by 2002:a17:906:ad99:: with SMTP id la25mr17163173ejb.63.1597717441391; Mon, 17 Aug 2020 19:24:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1597717441; cv=none; d=google.com; s=arc-20160816; b=t4+/3civ0953b9BDXAfog7mAkjMH5aHtRPWjaZI1Lvw+dLoHznKRf9+RECZTrP3qnt pQpErzArrdgp+Xhw3P3XdeEyueFwl6gtdInY0LVjuv3Q171r4C/tU75fGhUlQmPuWJFk Bw5EIerexRfNpqvoBUTAifohVZyzRlZIxrFN4lMVLk3RtuyN2w96DFM5GzV9HJNl05QW hbq9Nu6tNvGyV+JSyzvnCBtdCjm8GKyLle68Ic1opLubjCideEc0sYco/Z23g232VAnw 9F2bvwhQ4ZzkyEV99c7SBT4c7HecBLwqwzFYP3iQIImkGg5uoBwBtrlW39wo3S+Ai05E a+FQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=mAsFhKjAJTr/5jsuHUTdW43oBuQ2/ERWObuuWGysDtg=; b=wSYwCuca1cDL7AlJqDfMyzY5EscHsGEPlg6tY2d3TBOrxVMPsgfHWFOFKZWpLJTsWh jLls2WpUdsyEw6XUFcVWRDjZ/N26IuUJmQXQ7ZzQSDkHI6LFeQFHMPjKplabPZq2xNPp EgUr2fs5SdM+6PcTlVwmXAYzbTyUVKHT5Z/HDQrdBOY+shtBiTrBgWBjd3y9GXx18Dvp UnqLZiR3qI/d9gp6NQLlTrW0tFVL8kVo3W6ZYcMycUxdXDlmEN4/mcWjvRNWxbSUvu83 WXt34xevLwvwiFKWk+kWZqunoRse53ogw0zEEEXKO++cIYlAA0RNHI/AjmVwG9+Lzp8N X68Q== ARC-Authentication-Results: i=1; mx.google.com; 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 x13si12357757edv.323.2020.08.17.19.23.36; Mon, 17 Aug 2020 19:24:01 -0700 (PDT) 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; 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 S1726403AbgHRCXE (ORCPT + 99 others); Mon, 17 Aug 2020 22:23:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50798 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726303AbgHRCXE (ORCPT ); Mon, 17 Aug 2020 22:23:04 -0400 Received: from ZenIV.linux.org.uk (zeniv.linux.org.uk [IPv6:2002:c35c:fd02::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A83A0C061389; Mon, 17 Aug 2020 19:23:03 -0700 (PDT) Received: from viro by ZenIV.linux.org.uk with local (Exim 4.92.3 #3 (Red Hat Linux)) id 1k7rGz-0004QP-Sn; Tue, 18 Aug 2020 02:22:49 +0000 Date: Tue, 18 Aug 2020 03:22:49 +0100 From: Al Viro To: "Eric W. Biederman" Cc: linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, criu@openvz.org, bpf@vger.kernel.org, Linus Torvalds , Christian Brauner , Oleg Nesterov , Cyrill Gorcunov , Jann Horn , Kees Cook , Daniel =?iso-8859-1?Q?P=2E_Berrang=E9?= , Jeff Layton , Miklos Szeredi , Matthew Wilcox , "J. Bruce Fields" , Matthew Wilcox , Trond Myklebust , Chris Wright , Alexei Starovoitov , Daniel Borkmann , Martin KaFai Lau , Song Liu , Yonghong Song , Andrii Nakryiko , John Fastabend , KP Singh Subject: Re: [PATCH 10/17] proc/fd: In proc_readfd_common use fnext_task Message-ID: <20200818022249.GC1236603@ZenIV.linux.org.uk> References: <87ft8l6ic3.fsf@x220.int.ebiederm.org> <20200817220425.9389-10-ebiederm@xmission.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200817220425.9389-10-ebiederm@xmission.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Aug 17, 2020 at 05:04:18PM -0500, Eric W. Biederman wrote: > When discussing[1] exec and posix file locks it was realized that none > of the callers of get_files_struct fundamentally needed to call > get_files_struct, and that by switching them to helper functions > instead it will both simplify their code and remove unnecessary > increments of files_struct.count. Those unnecessary increments can > result in exec unnecessarily unsharing files_struct which breaking > posix locks, and it can result in fget_light having to fallback to > fget reducing system performance. > > Using fnext_task simplifies proc_readfd_common, by moving the checking > for the maximum file descritor into the generic code, and by > remvoing the need for capturing and releasing a reference on > files_struct. Yecchhh... So you keep locking/unlocking the damn thing for each descriptor?