From mboxrd@z Thu Jan 1 00:00:00 1970 From: Al Viro Date: Tue, 21 May 2019 19:20:09 +0000 Subject: Re: [PATCH 1/2] open: add close_range() Message-Id: <20190521192009.GK17978@ZenIV.linux.org.uk> List-Id: References: <20190521150006.GJ17978@ZenIV.linux.org.uk> <20190521113448.20654-1-christian@brauner.io> <28114.1558456227@warthog.procyon.org.uk> In-Reply-To: <28114.1558456227@warthog.procyon.org.uk> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: David Howells Cc: Christian Brauner , linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-api@vger.kernel.org, jannh@google.com, fweimer@redhat.com, oleg@redhat.com, tglx@linutronix.de, torvalds@linux-foundation.org, arnd@arndb.de, shuah@kernel.org, tkjos@android.com, ldv@altlinux.org, miklos@szeredi.hu, linux-alpha@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-ia64@vger.kernel.org, linux-m68k@lists.linux-m68k.org, linux-mips@vger.kernel.org, linux-parisc@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-s390@vger.kernel.org, linux-sh@vger.kernel.org, sparclinux@vger.kernel.org, linux-xtensa@linux-xtensa.org, linux-arch@vger.kernel.org, linux-kselftest@vger.kernel.org, x86@kernel.org On Tue, May 21, 2019 at 05:30:27PM +0100, David Howells wrote: > If we can live with close_from(int first) rather than close_range(), then this > can perhaps be done a lot more efficiently by: > > new = alloc_fdtable(first); > spin_lock(&files->file_lock); > old = files_fdtable(files); > copy_fds(new, old, 0, first - 1); > rcu_assign_pointer(files->fdt, new); > spin_unlock(&files->file_lock); > clear_fds(old, 0, first - 1); > close_fdt_from(old, first); > kfree_rcu(old); I really hate to think how that would interact with POSIX locks... From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.5 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_MUTT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 846BAC04E87 for ; Tue, 21 May 2019 19:20:27 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 5BD82217D9 for ; Tue, 21 May 2019 19:20:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727184AbfEUTUX (ORCPT ); Tue, 21 May 2019 15:20:23 -0400 Received: from zeniv.linux.org.uk ([195.92.253.2]:37620 "EHLO ZenIV.linux.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726525AbfEUTUW (ORCPT ); Tue, 21 May 2019 15:20:22 -0400 Received: from viro by ZenIV.linux.org.uk with local (Exim 4.92 #3 (Red Hat Linux)) id 1hTAIz-0003v8-BX; Tue, 21 May 2019 19:20:09 +0000 Date: Tue, 21 May 2019 20:20:09 +0100 From: Al Viro To: David Howells Cc: Christian Brauner , linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-api@vger.kernel.org, jannh@google.com, fweimer@redhat.com, oleg@redhat.com, tglx@linutronix.de, torvalds@linux-foundation.org, arnd@arndb.de, shuah@kernel.org, tkjos@android.com, ldv@altlinux.org, miklos@szeredi.hu, linux-alpha@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-ia64@vger.kernel.org, linux-m68k@lists.linux-m68k.org, linux-mips@vger.kernel.org, linux-parisc@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-s390@vger.kernel.org, linux-sh@vger.kernel.org, sparclinux@vger.kernel.org, linux-xtensa@linux-xtensa.org, linux-arch@vger.kernel.org, linux-kselftest@vger.kernel.org, x86@kernel.org Subject: Re: [PATCH 1/2] open: add close_range() Message-ID: <20190521192009.GK17978@ZenIV.linux.org.uk> References: <20190521150006.GJ17978@ZenIV.linux.org.uk> <20190521113448.20654-1-christian@brauner.io> <28114.1558456227@warthog.procyon.org.uk> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <28114.1558456227@warthog.procyon.org.uk> User-Agent: Mutt/1.11.3 (2019-02-01) Sender: linux-parisc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-parisc@vger.kernel.org On Tue, May 21, 2019 at 05:30:27PM +0100, David Howells wrote: > If we can live with close_from(int first) rather than close_range(), then this > can perhaps be done a lot more efficiently by: > > new = alloc_fdtable(first); > spin_lock(&files->file_lock); > old = files_fdtable(files); > copy_fds(new, old, 0, first - 1); > rcu_assign_pointer(files->fdt, new); > spin_unlock(&files->file_lock); > clear_fds(old, 0, first - 1); > close_fdt_from(old, first); > kfree_rcu(old); I really hate to think how that would interact with POSIX locks... From mboxrd@z Thu Jan 1 00:00:00 1970 From: viro at zeniv.linux.org.uk (Al Viro) Date: Tue, 21 May 2019 20:20:09 +0100 Subject: [PATCH 1/2] open: add close_range() In-Reply-To: <28114.1558456227@warthog.procyon.org.uk> References: <20190521150006.GJ17978@ZenIV.linux.org.uk> <20190521113448.20654-1-christian@brauner.io> <28114.1558456227@warthog.procyon.org.uk> Message-ID: <20190521192009.GK17978@ZenIV.linux.org.uk> On Tue, May 21, 2019 at 05:30:27PM +0100, David Howells wrote: > If we can live with close_from(int first) rather than close_range(), then this > can perhaps be done a lot more efficiently by: > > new = alloc_fdtable(first); > spin_lock(&files->file_lock); > old = files_fdtable(files); > copy_fds(new, old, 0, first - 1); > rcu_assign_pointer(files->fdt, new); > spin_unlock(&files->file_lock); > clear_fds(old, 0, first - 1); > close_fdt_from(old, first); > kfree_rcu(old); I really hate to think how that would interact with POSIX locks... From mboxrd@z Thu Jan 1 00:00:00 1970 From: viro@zeniv.linux.org.uk (Al Viro) Date: Tue, 21 May 2019 20:20:09 +0100 Subject: [PATCH 1/2] open: add close_range() In-Reply-To: <28114.1558456227@warthog.procyon.org.uk> References: <20190521150006.GJ17978@ZenIV.linux.org.uk> <20190521113448.20654-1-christian@brauner.io> <28114.1558456227@warthog.procyon.org.uk> Message-ID: <20190521192009.GK17978@ZenIV.linux.org.uk> Content-Type: text/plain; charset="UTF-8" Message-ID: <20190521192009.Bxh44TLBfY11vPO6TN5i0k40ih4eRwMiWgUHNiITkFw@z> On Tue, May 21, 2019@05:30:27PM +0100, David Howells wrote: > If we can live with close_from(int first) rather than close_range(), then this > can perhaps be done a lot more efficiently by: > > new = alloc_fdtable(first); > spin_lock(&files->file_lock); > old = files_fdtable(files); > copy_fds(new, old, 0, first - 1); > rcu_assign_pointer(files->fdt, new); > spin_unlock(&files->file_lock); > clear_fds(old, 0, first - 1); > close_fdt_from(old, first); > kfree_rcu(old); I really hate to think how that would interact with POSIX locks... From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.5 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_MUTT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4E694C04AAF for ; Tue, 21 May 2019 19:22:10 +0000 (UTC) Received: from lists.ozlabs.org (lists.ozlabs.org [203.11.71.2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id B6294217D7 for ; Tue, 21 May 2019 19:22:09 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org B6294217D7 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=zeniv.linux.org.uk Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=linuxppc-dev-bounces+linuxppc-dev=archiver.kernel.org@lists.ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 457ly70t0yzDqMv for ; Wed, 22 May 2019 05:22:07 +1000 (AEST) Authentication-Results: lists.ozlabs.org; spf=none (mailfrom) smtp.mailfrom=ftp.linux.org.uk (client-ip=195.92.253.2; helo=zeniv.linux.org.uk; envelope-from=viro@ftp.linux.org.uk; receiver=) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=zeniv.linux.org.uk Received: from ZenIV.linux.org.uk (zeniv.linux.org.uk [195.92.253.2]) (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 lists.ozlabs.org (Postfix) with ESMTPS id 457lwS250SzDqHL for ; Wed, 22 May 2019 05:20:37 +1000 (AEST) Received: from viro by ZenIV.linux.org.uk with local (Exim 4.92 #3 (Red Hat Linux)) id 1hTAIz-0003v8-BX; Tue, 21 May 2019 19:20:09 +0000 Date: Tue, 21 May 2019 20:20:09 +0100 From: Al Viro To: David Howells Subject: Re: [PATCH 1/2] open: add close_range() Message-ID: <20190521192009.GK17978@ZenIV.linux.org.uk> References: <20190521150006.GJ17978@ZenIV.linux.org.uk> <20190521113448.20654-1-christian@brauner.io> <28114.1558456227@warthog.procyon.org.uk> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <28114.1558456227@warthog.procyon.org.uk> User-Agent: Mutt/1.11.3 (2019-02-01) X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-ia64@vger.kernel.org, linux-sh@vger.kernel.org, oleg@redhat.com, linux-kselftest@vger.kernel.org, sparclinux@vger.kernel.org, shuah@kernel.org, linux-arch@vger.kernel.org, linux-s390@vger.kernel.org, miklos@szeredi.hu, x86@kernel.org, torvalds@linux-foundation.org, Christian Brauner , linux-mips@vger.kernel.org, linux-xtensa@linux-xtensa.org, tkjos@android.com, arnd@arndb.de, jannh@google.com, linux-m68k@lists.linux-m68k.org, tglx@linutronix.de, ldv@altlinux.org, linux-arm-kernel@lists.infradead.org, fweimer@redhat.com, linux-parisc@vger.kernel.org, linux-api@vger.kernel.org, linux-kernel@vger.kernel.org, linux-alpha@vger.kernel.org, linux-fsdevel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org Errors-To: linuxppc-dev-bounces+linuxppc-dev=archiver.kernel.org@lists.ozlabs.org Sender: "Linuxppc-dev" On Tue, May 21, 2019 at 05:30:27PM +0100, David Howells wrote: > If we can live with close_from(int first) rather than close_range(), then this > can perhaps be done a lot more efficiently by: > > new = alloc_fdtable(first); > spin_lock(&files->file_lock); > old = files_fdtable(files); > copy_fds(new, old, 0, first - 1); > rcu_assign_pointer(files->fdt, new); > spin_unlock(&files->file_lock); > clear_fds(old, 0, first - 1); > close_fdt_from(old, first); > kfree_rcu(old); I really hate to think how that would interact with POSIX locks... From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.5 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,USER_AGENT_MUTT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1BFCAC04AAF for ; Tue, 21 May 2019 19:20:40 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id E5775217D7 for ; Tue, 21 May 2019 19:20:39 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="Ok7I7hBO" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org E5775217D7 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=zeniv.linux.org.uk Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=o5vBcWhgdwB723el4mA2T0anz0byDpNV077oF/d3K4k=; b=Ok7I7hBOgbBO7r w7f+Fa/FC4cmVLYSVhbwSmwkaGOROKPqXxa89wPhldJFphXUzdDweh+gDrpJtw7M7plCc9btBKhu2 jKHbYdZl4J/yVJeCfhMPS9HFaD4Y3PNF89dy4hWZJ5uarzjvjbC1M0xA67A6bNJyI4TdpUgCnvT0B sAPcJhYzIK/AmRYpIb58QvaNgjlAIV1ZRgBf22cGxMKmArgjBUkoCgmfWFur9QcIBYb1g3M5vsd30 DDLJjE4F4Z/TMzZaHoWKcw+hyeP1gI9hTryOe28ww08Wt870FDLU9MpPzX3X8YiFVZSaQw1+phe35 aSawEa+Y6fxyRvrcPiNg==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1hTAJO-0002kB-U4; Tue, 21 May 2019 19:20:34 +0000 Received: from zeniv.linux.org.uk ([195.92.253.2]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1hTAJM-0002jp-A5 for linux-arm-kernel@lists.infradead.org; Tue, 21 May 2019 19:20:33 +0000 Received: from viro by ZenIV.linux.org.uk with local (Exim 4.92 #3 (Red Hat Linux)) id 1hTAIz-0003v8-BX; Tue, 21 May 2019 19:20:09 +0000 Date: Tue, 21 May 2019 20:20:09 +0100 From: Al Viro To: David Howells Subject: Re: [PATCH 1/2] open: add close_range() Message-ID: <20190521192009.GK17978@ZenIV.linux.org.uk> References: <20190521150006.GJ17978@ZenIV.linux.org.uk> <20190521113448.20654-1-christian@brauner.io> <28114.1558456227@warthog.procyon.org.uk> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <28114.1558456227@warthog.procyon.org.uk> User-Agent: Mutt/1.11.3 (2019-02-01) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190521_122032_351327_4F9F5819 X-CRM114-Status: UNSURE ( 9.01 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-ia64@vger.kernel.org, linux-sh@vger.kernel.org, oleg@redhat.com, linux-kselftest@vger.kernel.org, sparclinux@vger.kernel.org, shuah@kernel.org, linux-arch@vger.kernel.org, linux-s390@vger.kernel.org, miklos@szeredi.hu, x86@kernel.org, torvalds@linux-foundation.org, Christian Brauner , linux-mips@vger.kernel.org, linux-xtensa@linux-xtensa.org, tkjos@android.com, arnd@arndb.de, jannh@google.com, linux-m68k@lists.linux-m68k.org, tglx@linutronix.de, ldv@altlinux.org, linux-arm-kernel@lists.infradead.org, fweimer@redhat.com, linux-parisc@vger.kernel.org, linux-api@vger.kernel.org, linux-kernel@vger.kernel.org, linux-alpha@vger.kernel.org, linux-fsdevel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Tue, May 21, 2019 at 05:30:27PM +0100, David Howells wrote: > If we can live with close_from(int first) rather than close_range(), then this > can perhaps be done a lot more efficiently by: > > new = alloc_fdtable(first); > spin_lock(&files->file_lock); > old = files_fdtable(files); > copy_fds(new, old, 0, first - 1); > rcu_assign_pointer(files->fdt, new); > spin_unlock(&files->file_lock); > clear_fds(old, 0, first - 1); > close_fdt_from(old, first); > kfree_rcu(old); I really hate to think how that would interact with POSIX locks... _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel