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=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,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 A3D0FC04AB4 for ; Tue, 21 May 2019 20:23:34 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 77E8E2173E for ; Tue, 21 May 2019 20:23:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1558470214; bh=+anNa+EcDyQqpCdZyW1zAWtrJQKMwJ04olCg4LcelJQ=; h=References:In-Reply-To:From:Date:Subject:To:Cc:List-ID:From; b=vDA7If1qQjDpCuSrlmBf9NOf0ot7dauKmcEnNl+Q6HQEVkn+3q4gSUnUPpjY75uhx zMYHMKS+iJu3e3wz/So4dhDBLj8CdDpfkjoSmeJVE9Y/G2JJxbltZV+ERmBd2RfrXs HJaj3Nx0H3fM5carHxTJt5VU0MZuJPNyHghKQQrw= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727705AbfEUUXd (ORCPT ); Tue, 21 May 2019 16:23:33 -0400 Received: from mail-lf1-f68.google.com ([209.85.167.68]:35618 "EHLO mail-lf1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727156AbfEUUXc (ORCPT ); Tue, 21 May 2019 16:23:32 -0400 Received: by mail-lf1-f68.google.com with SMTP id c17so14121096lfi.2 for ; Tue, 21 May 2019 13:23:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux-foundation.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=mwA8SKkNo0NB1BSSFbQlGkhBkIi6dkzdh19hX1ggqqc=; b=E9cuWHFCD4Bgx1lOv97Ctr9bLKO3EjHQDpiZyM5FZUFuOxpsSHENK8V3oPkAEWY2CT 4OwJ0l1afyS0KlYgZEStFftLyE7H7JbMd/BnYgfS8lVdq73pcYKuqkBJcrl7o7GLJZCx 7466NcnIhfaDTvK1H+iwihEveSzhyKGC/2Zgk= 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=mwA8SKkNo0NB1BSSFbQlGkhBkIi6dkzdh19hX1ggqqc=; b=pi88AB1f2F4H7kXN9fZW3Ih4SoSxGrpASgG6Wt6zdT9la4HcBYzpC4VLI+oK/N97a/ fdJpYRz7xhGyJQD2S1F+rKt4tGd82Py+Js5g64JLNw2QDCXaHjNV9GndONiBZZVK8vZ+ 0Qqc/BgYLPj+ktKfFVVLaAyVDm5wz+m1CXG7AwW/ZGv6V4JLNKIC8tSew5sWMY5GKfjL X7dc8/hV+Mnlx+jwenRe11AoJWrAyboe3jlCgXQL3lmxxS970yIjPYAidINamrk36UR0 eVxlT0cc53+AdIeszhT/lyj+NIe3r38Fu70YRcC2Gt9bhHLjvYFEg52XzPNSYkkuPBZs JoiQ== X-Gm-Message-State: APjAAAX/LVmHdmKhhm+MwXkndfH+1lGSuaYi1dViG8n0sui4zN15xFBs Q8p52WuF/r7TUZ4Buu8isJ26cGspoo4= X-Google-Smtp-Source: APXvYqzNusEs3H4wWhDz6P2KdIQzeXHj204SQdISidyqektmS7QWBph4QU/a6GJfesaGboHEGbkofQ== X-Received: by 2002:ac2:483c:: with SMTP id 28mr22959580lft.93.1558470210408; Tue, 21 May 2019 13:23:30 -0700 (PDT) Received: from mail-lj1-f178.google.com (mail-lj1-f178.google.com. [209.85.208.178]) by smtp.gmail.com with ESMTPSA id r26sm4860405lfa.62.2019.05.21.13.23.29 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 21 May 2019 13:23:29 -0700 (PDT) Received: by mail-lj1-f178.google.com with SMTP id w1so18494ljw.0 for ; Tue, 21 May 2019 13:23:29 -0700 (PDT) X-Received: by 2002:a2e:2f03:: with SMTP id v3mr4725518ljv.6.1558470208997; Tue, 21 May 2019 13:23:28 -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: <20190521164141.rbehqnghiej3gfua@brauner.io> From: Linus Torvalds Date: Tue, 21 May 2019 13:23:13 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH 1/2] open: add close_range() To: Christian Brauner 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 , tkjos@android.com, "Dmitry V. Levin" , Miklos Szeredi , alpha , Linux ARM , linux-ia64@vger.kernel.org, linux-m68k , linux-mips@vger.kernel.org, linux-parisc@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-s390 , Linux-sh list , sparclinux@vger.kernel.org, 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-fsdevel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org 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. 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. Linus