Received: by 2002:a25:86ce:0:0:0:0:0 with SMTP id y14csp1402241ybm; Tue, 21 May 2019 13:32:11 -0700 (PDT) X-Google-Smtp-Source: APXvYqz+8U8RXf8lZ4I6pqM5wlLJyCiFSiEbV8ws+W9RLUXsKCL2zLxwQJS4Q5KflNmxKcVKqt/q X-Received: by 2002:a63:d613:: with SMTP id q19mr50423704pgg.339.1558470731654; Tue, 21 May 2019 13:32:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1558470731; cv=none; d=google.com; s=arc-20160816; b=c6nDjsiJoXrnIx76U/kiesRzRVe7BT3bI9GKSSQlBJVLViwHr5pnNhu9nQNpogLk13 Zx0yMAbJo+aNVuSA7N467cCIiaOZXZy+tGw45jlEgM7BdKir2d5ivLb0o395Z/uNPFr7 gjIPaVDynF+T1m3U55l3BPey4QSdN4i2Wq3iMUdSBmfoux+8bPpszH9Mx9dsMOO5U6TD P+xs9vDJ/N/aACdZR90Knglmlfsos7Zb3Aup4HEPfSD7Qzo36oZcxt8nHnyjBllYPSx9 EAt3iytUEX9UafueJ9nnI1zzkJDLWfZ6uS2UO3DMV2NgfvCrTBFqoMffqUkkwAPLI2kl jqFg== 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=mwA8SKkNo0NB1BSSFbQlGkhBkIi6dkzdh19hX1ggqqc=; b=ov1pcdSJRhgxslpSa7cl0nk5POugOFxMW6Id24+pbDuZ10iRnE+hYXMwSHMUR5cWXF sLoxdILW9xRZxVADShq0X88UGhe7w8u85fam4mK9E4S0igsnqtR3V1sBCLjbnEDiPt2p UBM1l8mTka08S0+hsF2b+pILvk5LOcfWb5grDHtTa4UxrZg4zIVaJJgn0tSiREnYKqYM zBqby5UogI2UsGUznUuYdKD1yXmj44L51wOasctPIfiwAvdsg8ZYm9bX3fapMeFq5XMc 2n0M8CDwh2xWUqDJUj1blOAQZmrtMVLiFXmyqAC9UDIDV+okcC3qGvg9+ihqD66RbOA7 uDEg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=google header.b=E9cuWHFC; 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 b193si25748379pfb.118.2019.05.21.13.31.56; Tue, 21 May 2019 13:32:11 -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=@linux-foundation.org header.s=google header.b=E9cuWHFC; 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 S1727493AbfEUUaV (ORCPT + 99 others); Tue, 21 May 2019 16:30:21 -0400 Received: from mail-lf1-f66.google.com ([209.85.167.66]:39978 "EHLO mail-lf1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726766AbfEUUaU (ORCPT ); Tue, 21 May 2019 16:30:20 -0400 Received: by mail-lf1-f66.google.com with SMTP id h13so14102522lfc.7 for ; Tue, 21 May 2019 13:30:19 -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=sCqgV5ralIFgo+jPntAqg0LYerrTLbRUhMfXkSMRAcP5D2PMbhCnDxbqu9znLDADaU mqpUOLST4T049hTJqO0wfa9roIbPoetsG0FnGTyVzY9o0wlCeZVw358hGOpfslQVEwiJ EA5e34hRSJeTLSE53+/lPF4uz/Wz+Kz7mwhAyJaT1e2LGjY8nW/tvombM+6bEAr6tnM3 GmYBnKSc/IAqu4u/j21o9EfqEaLmY5oqYabPBg/+3jBv1+co35qYVuzJsH7BwRqQ4JAC rUHzsobdTvlXpnv20T8EU8RxWjP8gitILQBaOQaUyDjS0zs+5XSvrJXVXoAr1F4vhmgr bpjQ== X-Gm-Message-State: APjAAAWlm48nQYMy5tUnzKLytvfTBhF1nm/zVvqyxUlMl7/s4MegpH8X bkxPl9ndNcoVort1MmFr+W++RftLkEQ= X-Received: by 2002:ac2:5212:: with SMTP id a18mr41295985lfl.166.1558470618654; Tue, 21 May 2019 13:30:18 -0700 (PDT) Received: from mail-lj1-f176.google.com (mail-lj1-f176.google.com. [209.85.208.176]) by smtp.gmail.com with ESMTPSA id v20sm4920095lfe.11.2019.05.21.13.30.18 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 21 May 2019 13:30:18 -0700 (PDT) Received: by mail-lj1-f176.google.com with SMTP id 14so10011ljj.5 for ; Tue, 21 May 2019 13:30:18 -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-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@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