From mboxrd@z Thu Jan 1 00:00:00 1970 From: Christian Brauner Date: Wed, 22 May 2019 08:12:11 +0000 Subject: Re: [PATCH 1/2] open: add close_range() Message-Id: List-Id: References: <20190521150006.GJ17978@ZenIV.linux.org.uk> <20190521113448.20654-1-christian@brauner.io> <28114.1558456227@warthog.procyon.org.uk> <20190521164141.rbehqnghiej3gfua@brauner.io> In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: Linus Torvalds Cc: David Howells , Al Viro , Linux List Kernel Mailing , linux-fsdevel , Linux API , Jann Horn , Florian Weimer , Oleg Nesterov , Thomas Gleixner , Arnd Bergmann , Shuah Khan , Todd Kjos , "Dmitry V. Levin" , Miklos Szeredi , alpha , Linux ARM , linux-ia64@vger.kernel.org, linux-m68k , linux-mips@vger.kernel.org, Parisc List On Tue, May 21, 2019 at 10:23 PM Linus Torvalds wrote: > > On Tue, May 21, 2019 at 9:41 AM Christian Brauner wrote: > > > > Yeah, you mentioned this before. I do like being able to specify an > > upper bound to have the ability to place fds strategically after said > > upper bound. > > I suspect that's the case. > > And if somebody really wants to just close everything and uses a large > upper bound, we can - if we really want to - just compare the upper > bound to the file table size, and do an optimized case for that. We do > that upper bound comparison anyway to limit the size of the walk, so > *if* it's a big deal, that case could then do the whole "shrink > fdtable" case too. Makes sense. > > But I don't believe it's worth optimizing for unless somebody really > has a load where that is shown to be a big deal. Just do the silly > and simple loop, and add a cond_resched() in the loop, like > close_files() does for the "we have a _lot_ of files open" case. Ok. I will resend a v1 later with the cond_resched() logic you and Al suggested added. Thanks! Christian 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=-1.1 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED 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 66CD9C072A4 for ; Wed, 22 May 2019 08:12:28 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 3925E2075B for ; Wed, 22 May 2019 08:12:28 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=brauner.io header.i=@brauner.io header.b="FQpPrYca" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726770AbfEVIMY (ORCPT ); Wed, 22 May 2019 04:12:24 -0400 Received: from mail-lf1-f66.google.com ([209.85.167.66]:33754 "EHLO mail-lf1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728598AbfEVIMY (ORCPT ); Wed, 22 May 2019 04:12:24 -0400 Received: by mail-lf1-f66.google.com with SMTP id x132so993881lfd.0 for ; Wed, 22 May 2019 01:12:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=brauner.io; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=NinRxNHyDYbCj8IbjH00ChDPuWJUmzxEB5UBBCZfvuk=; b=FQpPrYcaQxCAFGTYiUsPu0qLO+TyOcW7gshxdKkzEdBEoeF7zfGLnQVrcgcr4gKCeX LJ4YXrL36Z8UOIkkUcBOLv8jo3+1wy2Zrr1Gv+mEl7u90rBwnDVcVlXzHgwabis+F7I/ dlJlteIhWCGDFh11b+aiyTTGML6DsZQmYr7FjOpjo+237NiSY/93FSEYu5SmcuC+kMHi w+QbDlfq/QnsLdgPfA6Jf+xdMdism6B4eELfwRuNPZvO4gmtKOqxk/k31Xt7g6ek0i6A 6O4E/le0sudnktBxl+9AFEIeQt8N5n9ZAVs90K2h9eXQLV3Rz/8qfSLtahw9cvbBcJ3h 1JTg== 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=NinRxNHyDYbCj8IbjH00ChDPuWJUmzxEB5UBBCZfvuk=; b=JwLxLNwOAPKhFgTaFPtEPLVfVQ8pwOTDX1VPJVTFVXFODqMuiwSmaMBih7e4ivJyVX EICfFh1UF3mrYDUdYKvu3vmv6Py5Jzg9E+fiwDxu+Ru/dCiwVrEwdoyN2OjvZDaM0qzA FL/tz9qLDGQ5R08CEp06cf0fSwX35jdEdFUSbE+fJTTSj+FR2Sp5Cby7NC7Q+XsOwV6K zH8DOV/9su1DX1idyznNQiIBJOhrFUBhSei/zVW8SjzzG2w4nDcp6LYrQvJWCJ3Owupo L5xBanpBugNtiAXHtcUb5J8+El5Fb3JWM4Cwh5gFQ9G9LHCkphQrqWTYYBmUnUsVBNFA gfdw== X-Gm-Message-State: APjAAAXRSctjMQ1b9nZReDxXBEG5kh8+y4J5JdpCMW+g9x6JB+/2txXH SBfkLyhlVdFMv9NGrkr4ACsQPySowWN0gspyXlfhXA== X-Google-Smtp-Source: APXvYqx7pLLI28SrC6KCXMaRxdNQfwff8OtpKLPW6FHDJY0UodmrushWU4y7kAd+10dOgbbxHnK3LHfXY1UCm8GAhHE= X-Received: by 2002:a05:6512:1c1:: with SMTP id f1mr4469627lfp.125.1558512742198; Wed, 22 May 2019 01:12:22 -0700 (PDT) MIME-Version: 1.0 References: <20190521150006.GJ17978@ZenIV.linux.org.uk> <20190521113448.20654-1-christian@brauner.io> <28114.1558456227@warthog.procyon.org.uk> <20190521164141.rbehqnghiej3gfua@brauner.io> In-Reply-To: From: Christian Brauner Date: Wed, 22 May 2019 10:12:11 +0200 Message-ID: Subject: Re: [PATCH 1/2] open: add close_range() To: Linus Torvalds Cc: David Howells , Al Viro , Linux List Kernel Mailing , linux-fsdevel , Linux API , Jann Horn , Florian Weimer , Oleg Nesterov , Thomas Gleixner , Arnd Bergmann , Shuah Khan , Todd Kjos , "Dmitry V. Levin" , Miklos Szeredi , alpha , Linux ARM , linux-ia64@vger.kernel.org, linux-m68k , linux-mips@vger.kernel.org, Parisc List , linuxppc-dev , linux-s390 , Linux-sh list , sparclinux , linux-xtensa@linux-xtensa.org, linux-arch , "open list:KERNEL SELFTEST FRAMEWORK" , "the arch/x86 maintainers" Content-Type: text/plain; charset="UTF-8" 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 10:23 PM Linus Torvalds wrote: > > On Tue, May 21, 2019 at 9:41 AM Christian Brauner wrote: > > > > Yeah, you mentioned this before. I do like being able to specify an > > upper bound to have the ability to place fds strategically after said > > upper bound. > > I suspect that's the case. > > And if somebody really wants to just close everything and uses a large > upper bound, we can - if we really want to - just compare the upper > bound to the file table size, and do an optimized case for that. We do > that upper bound comparison anyway to limit the size of the walk, so > *if* it's a big deal, that case could then do the whole "shrink > fdtable" case too. Makes sense. > > But I don't believe it's worth optimizing for unless somebody really > has a load where that is shown to be a big deal. Just do the silly > and simple loop, and add a cond_resched() in the loop, like > close_files() does for the "we have a _lot_ of files open" case. Ok. I will resend a v1 later with the cond_resched() logic you and Al suggested added. Thanks! Christian From mboxrd@z Thu Jan 1 00:00:00 1970 From: christian at brauner.io (Christian Brauner) Date: Wed, 22 May 2019 10:12:11 +0200 Subject: [PATCH 1/2] open: add close_range() In-Reply-To: References: <20190521150006.GJ17978@ZenIV.linux.org.uk> <20190521113448.20654-1-christian@brauner.io> <28114.1558456227@warthog.procyon.org.uk> <20190521164141.rbehqnghiej3gfua@brauner.io> Message-ID: On Tue, May 21, 2019 at 10:23 PM Linus Torvalds wrote: > > On Tue, May 21, 2019 at 9:41 AM Christian Brauner wrote: > > > > Yeah, you mentioned this before. I do like being able to specify an > > upper bound to have the ability to place fds strategically after said > > upper bound. > > I suspect that's the case. > > And if somebody really wants to just close everything and uses a large > upper bound, we can - if we really want to - just compare the upper > bound to the file table size, and do an optimized case for that. We do > that upper bound comparison anyway to limit the size of the walk, so > *if* it's a big deal, that case could then do the whole "shrink > fdtable" case too. Makes sense. > > But I don't believe it's worth optimizing for unless somebody really > has a load where that is shown to be a big deal. Just do the silly > and simple loop, and add a cond_resched() in the loop, like > close_files() does for the "we have a _lot_ of files open" case. Ok. I will resend a v1 later with the cond_resched() logic you and Al suggested added. Thanks! Christian From mboxrd@z Thu Jan 1 00:00:00 1970 From: christian@brauner.io (Christian Brauner) Date: Wed, 22 May 2019 10:12:11 +0200 Subject: [PATCH 1/2] open: add close_range() In-Reply-To: References: <20190521150006.GJ17978@ZenIV.linux.org.uk> <20190521113448.20654-1-christian@brauner.io> <28114.1558456227@warthog.procyon.org.uk> <20190521164141.rbehqnghiej3gfua@brauner.io> Message-ID: Content-Type: text/plain; charset="UTF-8" Message-ID: <20190522081211.urfsH7Od9OuXnL6dUXs7BcSsmMVp2_hkVsjTCSmTIHU@z> On Tue, May 21, 2019 at 10:23 PM Linus Torvalds wrote: > > On Tue, May 21, 2019@9:41 AM Christian Brauner wrote: > > > > Yeah, you mentioned this before. I do like being able to specify an > > upper bound to have the ability to place fds strategically after said > > upper bound. > > I suspect that's the case. > > And if somebody really wants to just close everything and uses a large > upper bound, we can - if we really want to - just compare the upper > bound to the file table size, and do an optimized case for that. We do > that upper bound comparison anyway to limit the size of the walk, so > *if* it's a big deal, that case could then do the whole "shrink > fdtable" case too. Makes sense. > > But I don't believe it's worth optimizing for unless somebody really > has a load where that is shown to be a big deal. Just do the silly > and simple loop, and add a cond_resched() in the loop, like > close_files() does for the "we have a _lot_ of files open" case. Ok. I will resend a v1 later with the cond_resched() logic you and Al suggested added. Thanks! Christian From mboxrd@z Thu Jan 1 00:00:00 1970 From: Christian Brauner Subject: Re: [PATCH 1/2] open: add close_range() Date: Wed, 22 May 2019 10:12:11 +0200 Message-ID: References: <20190521150006.GJ17978@ZenIV.linux.org.uk> <20190521113448.20654-1-christian@brauner.io> <28114.1558456227@warthog.procyon.org.uk> <20190521164141.rbehqnghiej3gfua@brauner.io> Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Return-path: In-Reply-To: Sender: linux-kernel-owner@vger.kernel.org To: Linus Torvalds Cc: David Howells , Al Viro , Linux List Kernel Mailing , linux-fsdevel , Linux API , Jann Horn , Florian Weimer , Oleg Nesterov , Thomas Gleixner , Arnd Bergmann , Shuah Khan , Todd Kjos , "Dmitry V. Levin" , Miklos Szeredi , alpha , Linux ARM , linux-ia64@vger.kernel.org, linux-m68k , linux-mips@vger.kernel.org, Parisc List List-Id: linux-api@vger.kernel.org On Tue, May 21, 2019 at 10:23 PM Linus Torvalds wrote: > > On Tue, May 21, 2019 at 9:41 AM Christian Brauner wrote: > > > > Yeah, you mentioned this before. I do like being able to specify an > > upper bound to have the ability to place fds strategically after said > > upper bound. > > I suspect that's the case. > > And if somebody really wants to just close everything and uses a large > upper bound, we can - if we really want to - just compare the upper > bound to the file table size, and do an optimized case for that. We do > that upper bound comparison anyway to limit the size of the walk, so > *if* it's a big deal, that case could then do the whole "shrink > fdtable" case too. Makes sense. > > But I don't believe it's worth optimizing for unless somebody really > has a load where that is shown to be a big deal. Just do the silly > and simple loop, and add a cond_resched() in the loop, like > close_files() does for the "we have a _lot_ of files open" case. Ok. I will resend a v1 later with the cond_resched() logic you and Al suggested added. Thanks! Christian From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-lf1-f65.google.com ([209.85.167.65]:36883 "EHLO mail-lf1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726358AbfEVIMY (ORCPT ); Wed, 22 May 2019 04:12:24 -0400 Received: by mail-lf1-f65.google.com with SMTP id m15so360424lfh.4 for ; Wed, 22 May 2019 01:12:23 -0700 (PDT) MIME-Version: 1.0 References: <20190521150006.GJ17978@ZenIV.linux.org.uk> <20190521113448.20654-1-christian@brauner.io> <28114.1558456227@warthog.procyon.org.uk> <20190521164141.rbehqnghiej3gfua@brauner.io> In-Reply-To: From: Christian Brauner Date: Wed, 22 May 2019 10:12:11 +0200 Message-ID: Subject: Re: [PATCH 1/2] open: add close_range() Content-Type: text/plain; charset="UTF-8" Sender: linux-arch-owner@vger.kernel.org List-ID: To: Linus Torvalds Cc: David Howells , Al Viro , Linux List Kernel Mailing , linux-fsdevel , Linux API , Jann Horn , Florian Weimer , Oleg Nesterov , Thomas Gleixner , Arnd Bergmann , Shuah Khan , Todd Kjos , "Dmitry V. Levin" , Miklos Szeredi , alpha , Linux ARM , linux-ia64@vger.kernel.org, linux-m68k , linux-mips@vger.kernel.org, Parisc List , linuxppc-dev , linux-s390 , Linux-sh list , sparclinux , linux-xtensa@linux-xtensa.org, linux-arch , "open list:KERNEL SELFTEST FRAMEWORK" , the arch/x86 maintainers Message-ID: <20190522081211.gSmTHxw7I147Yx_blqVP0849x9x6HJjy46t9j7DTjgc@z> On Tue, May 21, 2019 at 10:23 PM Linus Torvalds wrote: > > On Tue, May 21, 2019 at 9:41 AM Christian Brauner wrote: > > > > Yeah, you mentioned this before. I do like being able to specify an > > upper bound to have the ability to place fds strategically after said > > upper bound. > > I suspect that's the case. > > And if somebody really wants to just close everything and uses a large > upper bound, we can - if we really want to - just compare the upper > bound to the file table size, and do an optimized case for that. We do > that upper bound comparison anyway to limit the size of the walk, so > *if* it's a big deal, that case could then do the whole "shrink > fdtable" case too. Makes sense. > > But I don't believe it's worth optimizing for unless somebody really > has a load where that is shown to be a big deal. Just do the silly > and simple loop, and add a cond_resched() in the loop, like > close_files() does for the "we have a _lot_ of files open" case. Ok. I will resend a v1 later with the cond_resched() logic you and Al suggested added. Thanks! Christian 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=-0.8 required=3.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS 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 D9D8CC072A4 for ; Wed, 22 May 2019 08:13:50 +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 26F6A20815 for ; Wed, 22 May 2019 08:13:50 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=brauner.io header.i=@brauner.io header.b="FQpPrYca" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 26F6A20815 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=brauner.io 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 45854X1hX5zDqNj for ; Wed, 22 May 2019 18:13:48 +1000 (AEST) Authentication-Results: lists.ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=brauner.io (client-ip=2a00:1450:4864:20::142; helo=mail-lf1-x142.google.com; envelope-from=christian@brauner.io; receiver=) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=brauner.io Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; secure) header.d=brauner.io header.i=@brauner.io header.b="FQpPrYca"; dkim-atps=neutral Received: from mail-lf1-x142.google.com (mail-lf1-x142.google.com [IPv6:2a00:1450:4864:20::142]) (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 4585306Dp2zDqLP for ; Wed, 22 May 2019 18:12:26 +1000 (AEST) Received: by mail-lf1-x142.google.com with SMTP id y10so979233lfl.3 for ; Wed, 22 May 2019 01:12:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=brauner.io; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=NinRxNHyDYbCj8IbjH00ChDPuWJUmzxEB5UBBCZfvuk=; b=FQpPrYcaQxCAFGTYiUsPu0qLO+TyOcW7gshxdKkzEdBEoeF7zfGLnQVrcgcr4gKCeX LJ4YXrL36Z8UOIkkUcBOLv8jo3+1wy2Zrr1Gv+mEl7u90rBwnDVcVlXzHgwabis+F7I/ dlJlteIhWCGDFh11b+aiyTTGML6DsZQmYr7FjOpjo+237NiSY/93FSEYu5SmcuC+kMHi w+QbDlfq/QnsLdgPfA6Jf+xdMdism6B4eELfwRuNPZvO4gmtKOqxk/k31Xt7g6ek0i6A 6O4E/le0sudnktBxl+9AFEIeQt8N5n9ZAVs90K2h9eXQLV3Rz/8qfSLtahw9cvbBcJ3h 1JTg== 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=NinRxNHyDYbCj8IbjH00ChDPuWJUmzxEB5UBBCZfvuk=; b=PDDLtm4FMtzy3IpykMG2uM+R7mOVAyYPkIbsQu6KIKUC5v1/BHEcVJPOkbFkebZA7p KI24EuNk6FhCPwVwr5yLykGPtt2RD8gNhImobjyViUAc9S1eRxY8tzMBeT7+b+wNKo0+ pNDhDIJWtSn2qWzV34l1BWQpSUNr1KCf+n+fX0r/0HcOBLP/r2pG1hVoq1SfK4glDQKE YVsIp8KEQEnJR4jdhlxlGdEtRCT49WnxHzlz9B0On48T4+lpRbwNXxgHSCN3EExV93il jeoF20t4ujAWgHlYAchvUM8zh9QDhDXzj34YN3ZBkrtVMVRswtNVOC0k9NrraGdB0Ga3 2xrw== X-Gm-Message-State: APjAAAUSXz+4qrChY+H6hiRQjBYPBClQCTU9i1jJxZo+VbLDoSL7krpR m9Pkkye/7rcVTcXBFqnxsEpFdr5b4MD0um08t999yA== X-Google-Smtp-Source: APXvYqx7pLLI28SrC6KCXMaRxdNQfwff8OtpKLPW6FHDJY0UodmrushWU4y7kAd+10dOgbbxHnK3LHfXY1UCm8GAhHE= X-Received: by 2002:a05:6512:1c1:: with SMTP id f1mr4469627lfp.125.1558512742198; Wed, 22 May 2019 01:12:22 -0700 (PDT) MIME-Version: 1.0 References: <20190521150006.GJ17978@ZenIV.linux.org.uk> <20190521113448.20654-1-christian@brauner.io> <28114.1558456227@warthog.procyon.org.uk> <20190521164141.rbehqnghiej3gfua@brauner.io> In-Reply-To: From: Christian Brauner Date: Wed, 22 May 2019 10:12:11 +0200 Message-ID: Subject: Re: [PATCH 1/2] open: add close_range() To: Linus Torvalds Content-Type: text/plain; charset="UTF-8" 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 list , Oleg Nesterov , David Howells , "open list:KERNEL SELFTEST FRAMEWORK" , sparclinux , Shuah Khan , linux-arch , linux-s390 , Miklos Szeredi , the arch/x86 maintainers , linux-mips@vger.kernel.org, linux-xtensa@linux-xtensa.org, Todd Kjos , Arnd Bergmann , Jann Horn , linux-m68k , Al Viro , Thomas Gleixner , "Dmitry V. Levin" , Linux ARM , Florian Weimer , Parisc List , Linux API , Linux List Kernel Mailing , alpha , linux-fsdevel , linuxppc-dev Errors-To: linuxppc-dev-bounces+linuxppc-dev=archiver.kernel.org@lists.ozlabs.org Sender: "Linuxppc-dev" On Tue, May 21, 2019 at 10:23 PM Linus Torvalds wrote: > > On Tue, May 21, 2019 at 9:41 AM Christian Brauner wrote: > > > > Yeah, you mentioned this before. I do like being able to specify an > > upper bound to have the ability to place fds strategically after said > > upper bound. > > I suspect that's the case. > > And if somebody really wants to just close everything and uses a large > upper bound, we can - if we really want to - just compare the upper > bound to the file table size, and do an optimized case for that. We do > that upper bound comparison anyway to limit the size of the walk, so > *if* it's a big deal, that case could then do the whole "shrink > fdtable" case too. Makes sense. > > But I don't believe it's worth optimizing for unless somebody really > has a load where that is shown to be a big deal. Just do the silly > and simple loop, and add a cond_resched() in the loop, like > close_files() does for the "we have a _lot_ of files open" case. Ok. I will resend a v1 later with the cond_resched() logic you and Al suggested added. Thanks! Christian 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=-1.0 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED 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 A7408C072A4 for ; Wed, 22 May 2019 08:12:36 +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 7C51C2075B for ; Wed, 22 May 2019 08:12:36 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="rxjZiPvB"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=brauner.io header.i=@brauner.io header.b="FQpPrYca" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 7C51C2075B Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=brauner.io 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:To:Subject:Message-ID:Date:From: In-Reply-To:References:MIME-Version:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=ZBbkHR70STJTnski/hgYmveiAwS/Et7930UdEUCl/Bs=; b=rxjZiPvBTQresn I78wegWwZTA3RW6NOD3Up01zE3PBTQgprg/czmZiJiZHG6yuZyFLSNc4k3sHb3J8InEwYad+jKr+M SSg17Yz6XBoRAhBlnPYAJVvm2cgMG6SqpjaCHDijK4W9ElQuHnTx2BZRDsS2LYwUMHlLJKPSMUGRe SSRk4SPUf6lzbO8WSV40xG9ZuBJDLUfwduTiz+BfvSguZPKg8ZCbjHG35OLyLgAreUNeT1yYNAJ8G UGZBQOqK+u+I4+TqlWDb3p6DoW3A05E6EYc8NzI18QXzXlVOl6oBCxdce13/tSSBJmpZvMX5nSKkN vgF+vNFdlAGa9itizTVg==; 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 1hTMMP-0000xE-IZ; Wed, 22 May 2019 08:12:29 +0000 Received: from mail-lf1-x141.google.com ([2a00:1450:4864:20::141]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1hTMMM-0000wP-SJ for linux-arm-kernel@lists.infradead.org; Wed, 22 May 2019 08:12:28 +0000 Received: by mail-lf1-x141.google.com with SMTP id h13so971949lfc.7 for ; Wed, 22 May 2019 01:12:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=brauner.io; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=NinRxNHyDYbCj8IbjH00ChDPuWJUmzxEB5UBBCZfvuk=; b=FQpPrYcaQxCAFGTYiUsPu0qLO+TyOcW7gshxdKkzEdBEoeF7zfGLnQVrcgcr4gKCeX LJ4YXrL36Z8UOIkkUcBOLv8jo3+1wy2Zrr1Gv+mEl7u90rBwnDVcVlXzHgwabis+F7I/ dlJlteIhWCGDFh11b+aiyTTGML6DsZQmYr7FjOpjo+237NiSY/93FSEYu5SmcuC+kMHi w+QbDlfq/QnsLdgPfA6Jf+xdMdism6B4eELfwRuNPZvO4gmtKOqxk/k31Xt7g6ek0i6A 6O4E/le0sudnktBxl+9AFEIeQt8N5n9ZAVs90K2h9eXQLV3Rz/8qfSLtahw9cvbBcJ3h 1JTg== 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=NinRxNHyDYbCj8IbjH00ChDPuWJUmzxEB5UBBCZfvuk=; b=lrOYFC8Sx5LhWZHDDZ/tx7u9T1MBeoWcfAQyyOLSBcAxFwYF1+lec9qPX+bNBie6lZ AykAdGHGJFF37KRPx+KNXdfzt1zcwwAZW0/jBYQ03xN+/ByuTpHBGRNgyxL90eLKfGZk hE28JXR+y6Mia0e4L7aFxre16QqdRf+jcuI8rFUBtNSVyW0+SgSfSjCYq3zgYW5ViHQV 5L/2KDPCmrI7JdBN+GrGTg54CjW3Qa8081hwcU2ddfnSl1um+5OPrldijy3S/J8lPoVw MPhjyKb8zur0ZuuJlXvLFvQ3cn5qG3BZ9szcIU/0ddEeuasbAD4hiuashafzgaT8jJFu qFqg== X-Gm-Message-State: APjAAAVAXO4H2TmdRewBhPRadp+0v87j4iNP3ZaViCYq0TgsI9+RT6TZ 5w64T0/B1A8rn/Z39b2AhycBIWXng6TYSLCogwtnXg== X-Google-Smtp-Source: APXvYqx7pLLI28SrC6KCXMaRxdNQfwff8OtpKLPW6FHDJY0UodmrushWU4y7kAd+10dOgbbxHnK3LHfXY1UCm8GAhHE= X-Received: by 2002:a05:6512:1c1:: with SMTP id f1mr4469627lfp.125.1558512742198; Wed, 22 May 2019 01:12:22 -0700 (PDT) MIME-Version: 1.0 References: <20190521150006.GJ17978@ZenIV.linux.org.uk> <20190521113448.20654-1-christian@brauner.io> <28114.1558456227@warthog.procyon.org.uk> <20190521164141.rbehqnghiej3gfua@brauner.io> In-Reply-To: From: Christian Brauner Date: Wed, 22 May 2019 10:12:11 +0200 Message-ID: Subject: Re: [PATCH 1/2] open: add close_range() To: Linus Torvalds X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190522_011226_916905_46607114 X-CRM114-Status: GOOD ( 13.52 ) 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 list , Oleg Nesterov , David Howells , "open list:KERNEL SELFTEST FRAMEWORK" , sparclinux , Shuah Khan , linux-arch , linux-s390 , Miklos Szeredi , the arch/x86 maintainers , linux-mips@vger.kernel.org, linux-xtensa@linux-xtensa.org, Todd Kjos , Arnd Bergmann , Jann Horn , linux-m68k , Al Viro , Thomas Gleixner , "Dmitry V. Levin" , Linux ARM , Florian Weimer , Parisc List , Linux API , Linux List Kernel Mailing , alpha , linux-fsdevel , linuxppc-dev 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 10:23 PM Linus Torvalds wrote: > > On Tue, May 21, 2019 at 9:41 AM Christian Brauner wrote: > > > > Yeah, you mentioned this before. I do like being able to specify an > > upper bound to have the ability to place fds strategically after said > > upper bound. > > I suspect that's the case. > > And if somebody really wants to just close everything and uses a large > upper bound, we can - if we really want to - just compare the upper > bound to the file table size, and do an optimized case for that. We do > that upper bound comparison anyway to limit the size of the walk, so > *if* it's a big deal, that case could then do the whole "shrink > fdtable" case too. Makes sense. > > But I don't believe it's worth optimizing for unless somebody really > has a load where that is shown to be a big deal. Just do the silly > and simple loop, and add a cond_resched() in the loop, like > close_files() does for the "we have a _lot_ of files open" case. Ok. I will resend a v1 later with the cond_resched() logic you and Al suggested added. Thanks! Christian _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel