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,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 6D4E3C433E6 for ; Mon, 22 Feb 2021 10:11:52 +0000 (UTC) Received: from smtp1.osuosl.org (smtp1.osuosl.org [140.211.166.138]) (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 EBC4164E20 for ; Mon, 22 Feb 2021 10:11:51 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org EBC4164E20 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=containers-bounces@lists.linux-foundation.org Received: from localhost (localhost [127.0.0.1]) by smtp1.osuosl.org (Postfix) with ESMTP id 8F46683503; Mon, 22 Feb 2021 10:11:51 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp1.osuosl.org ([127.0.0.1]) by localhost (smtp1.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id DM5QBF1NOJoP; Mon, 22 Feb 2021 10:11:50 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by smtp1.osuosl.org (Postfix) with ESMTP id 7313983518; Mon, 22 Feb 2021 10:11:50 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id F3335C000B; Mon, 22 Feb 2021 10:11:49 +0000 (UTC) Received: from smtp3.osuosl.org (smtp3.osuosl.org [140.211.166.136]) by lists.linuxfoundation.org (Postfix) with ESMTP id E4116C0001 for ; Mon, 22 Feb 2021 10:11:48 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp3.osuosl.org (Postfix) with ESMTP id C853B6F556 for ; Mon, 22 Feb 2021 10:11:48 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp3.osuosl.org ([127.0.0.1]) by localhost (smtp3.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id l37LPRzpkTs9 for ; Mon, 22 Feb 2021 10:11:47 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.8.0 Received: from raptor.unsafe.ru (raptor.unsafe.ru [5.9.43.93]) by smtp3.osuosl.org (Postfix) with ESMTP id B22266F54D for ; Mon, 22 Feb 2021 10:11:47 +0000 (UTC) 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 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-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) Cc: Kees Cook , Kernel Hardening , Linux Containers , Jann Horn , LKML , Oleg Nesterov , linux-mm@kvack.org, "Eric W . Biederman" , Andrew Morton , Linus Torvalds , io-uring@vger.kernel.org X-BeenThere: containers@lists.linux-foundation.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: Linux Containers List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: containers-bounces@lists.linux-foundation.org Sender: "Containers" 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 _______________________________________________ Containers mailing list Containers@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/containers 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 1FE6CC433DB for ; Mon, 22 Feb 2021 10:15:29 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id C842C64E20 for ; Mon, 22 Feb 2021 10:15:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229995AbhBVKPH (ORCPT ); Mon, 22 Feb 2021 05:15:07 -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: linux-kernel@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