Received: by 2002:a25:86ce:0:0:0:0:0 with SMTP id y14csp187733ybm; Wed, 22 May 2019 01:14:59 -0700 (PDT) X-Google-Smtp-Source: APXvYqxfyrd5lZDmnRYQyvT3ucd0ank1INBwN4cowBgYwr19rEJDMtBewWHwk/7CcSUs0h7JLlCs X-Received: by 2002:a17:902:b094:: with SMTP id p20mr65276588plr.164.1558512899401; Wed, 22 May 2019 01:14:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1558512899; cv=none; d=google.com; s=arc-20160816; b=svm4JlGHRe+nTy9RWEvC1NWaIbZibqcKL2b1vttPUN9JvkhcyaJ2NPKbFGsjbFzxCB 34736I435uLpNJWXlDdXdWtA02oQBdZzseBJtvjNH4t6dIlnaBVXc8RPpb3VAaXFu8DI zNoTNj1XSU5tej+kJoOSGoRMh/zZDRak7/7mRDoxEd3qqOw4lBRALeHQnMtXLEnzUzFN 1xAvHF9ZszWdDtkC8rOQODvZ+0a0Ox7xnL4eMHyGpmehdFaENYhLqu4PM3uc1IOGLlq9 pbLbWpNWi6eE/3xfcv/9uVsT30ilJUosHh8QndlIFynHHPtmpVC0CIkL5u7vOQS2SfDz AerQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=NinRxNHyDYbCj8IbjH00ChDPuWJUmzxEB5UBBCZfvuk=; b=niexNggukJha/fRnpcmkTsfuV95gsgZ7RHwVbpXOXu4Lkbloh9+lMK3unnA2WM4QwW i7H2oSDI/HIqD07M2ABJs50Bodaisk18y/g5G6TVq/MIJLMYlNsExmkSe/nBtcCBT/3v aG83s7dfqcnc2eYgSpe7YNSykloE7LzOUyaCPj9bGFWwSU8hCv97Aj7lfMSYbPgjkvME LW76U9HWJzaz0LE2ow5oii2+wSKRkTc0i9zxpieqVgNL6x7Kh/ZJlm1eVPCQhtjSZuvJ 3z9PghXe5COUPeM987m3Sc2budgIdcssJMPHVVwhKNB+dQSlMKmBKNBhMC4eCeoDdimF KOIQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@brauner.io header.s=google header.b=FQpPrYca; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v13si23832162plo.429.2019.05.22.01.14.44; Wed, 22 May 2019 01:14:59 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@brauner.io header.s=google header.b=FQpPrYca; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728690AbfEVIMZ (ORCPT + 99 others); Wed, 22 May 2019 04:12:25 -0400 Received: from mail-lf1-f67.google.com ([209.85.167.67]:35111 "EHLO mail-lf1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728610AbfEVIMY (ORCPT ); Wed, 22 May 2019 04:12:24 -0400 Received: by mail-lf1-f67.google.com with SMTP id c17so986541lfi.2 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=ft9YheLDdUKpLZNNnqPS4LtOefQofQTVY5WDgpzG5aaz+ab9ghwIgNZ3HcgVZybqte kyHqby0i9VrPyfrd6mDA6ooCkLKGASmzqi9zqnh6f7Cv3DWW2v/mEY6bfJdHZI81PX7a 08Y24wb5pH5i/Ps/t9seQTCs1XHPggB+u70Hix7fLFrSCWN3coDRnD0TsJLCYXEloxLc NR2zLBAqp5TxVzx8l8lF7kGrbVREv0PX8ZdEgkKiPb9G7CmSsB9IVycZQ0nk7gLOMI/Z 6ry9j9c1FjkF6MVkn/vZM/hAXhNS+1OkXQexCqrBndwE5X85ukcZdg90f+2V+1hb8KGF luEA== X-Gm-Message-State: APjAAAWgXzwy0bZvtUQPA0pRiX6pX7C05okVVI381nTY1X9OI92EOLSF e/CS4RXIHRCQi1QEe0cKBCkZJ1xzArgRQxE9Gb3Qsg== 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-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@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