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=-10.7 required=3.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, MENTIONS_GIT_HOSTING,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 97889C433E0 for ; Mon, 22 Feb 2021 10:13:47 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 515EE64E25 for ; Mon, 22 Feb 2021 10:13:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230420AbhBVKNf (ORCPT ); Mon, 22 Feb 2021 05:13:35 -0500 Received: from raptor.unsafe.ru ([5.9.43.93]:58216 "EHLO raptor.unsafe.ru" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230375AbhBVKMa (ORCPT ); Mon, 22 Feb 2021 05:12:30 -0500 Received: from example.org (ip-94-113-225-162.net.upcbroadband.cz [94.113.225.162]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by raptor.unsafe.ru (Postfix) with ESMTPSA id 3E86D209FA; Mon, 22 Feb 2021 10:11:46 +0000 (UTC) Date: Mon, 22 Feb 2021 11:11:41 +0100 From: Alexey Gladkov To: Jens Axboe Cc: LKML , io-uring@vger.kernel.org, Kernel Hardening , Linux Containers , linux-mm@kvack.org, Andrew Morton , Christian Brauner , "Eric W . Biederman" , Jann Horn , Kees Cook , Linus Torvalds , Oleg Nesterov Subject: Re: [PATCH v6 3/7] Reimplement RLIMIT_NPROC on top of ucounts Message-ID: <20210222101141.uve6hnftsakf4u7n@example.org> References: <72fdcd154bec7e0dfad090f1af65ddac1e767451.1613392826.git.gladkov.alexey@gmail.com> <72214339-57fc-e47f-bb57-d1b39c69e38e@kernel.dk> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <72214339-57fc-e47f-bb57-d1b39c69e38e@kernel.dk> X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.6.1 (raptor.unsafe.ru [5.9.43.93]); Mon, 22 Feb 2021 10:11:46 +0000 (UTC) Precedence: bulk List-ID: X-Mailing-List: io-uring@vger.kernel.org On Sun, Feb 21, 2021 at 04:38:10PM -0700, Jens Axboe wrote: > On 2/15/21 5:41 AM, Alexey Gladkov wrote: > > diff --git a/fs/io-wq.c b/fs/io-wq.c > > index a564f36e260c..5b6940c90c61 100644 > > --- a/fs/io-wq.c > > +++ b/fs/io-wq.c > > @@ -1090,10 +1091,7 @@ struct io_wq *io_wq_create(unsigned bounded, struct io_wq_data *data) > > wqe->node = alloc_node; > > wqe->acct[IO_WQ_ACCT_BOUND].max_workers = bounded; > > atomic_set(&wqe->acct[IO_WQ_ACCT_BOUND].nr_running, 0); > > - if (wq->user) { > > - wqe->acct[IO_WQ_ACCT_UNBOUND].max_workers = > > - task_rlimit(current, RLIMIT_NPROC); > > - } > > + wqe->acct[IO_WQ_ACCT_UNBOUND].max_workers = task_rlimit(current, RLIMIT_NPROC); > > This doesn't look like an equivalent transformation. But that may be > moot if we merge the io_uring-worker.v3 series, as then you would not > have to touch io-wq at all. In the current code the wq->user is always set to current_user(): io_uring_create [1] `- io_sq_offload_create `- io_init_wq_offload [2] `-io_wq_create [3] [1] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/fs/io_uring.c#n9752 [2] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/fs/io_uring.c#n8107 [3] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/fs/io-wq.c#n1070 So, specifying max_workers always happens. -- Rgrds, legion