Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp1455309pxb; Mon, 22 Feb 2021 02:17:49 -0800 (PST) X-Google-Smtp-Source: ABdhPJysXq4Fv6ojjOKxG4SkvCiBkceViQo+w3pOWyqi4QzjpG6HW4P+NM5xsF8diTJlyck4t/6q X-Received: by 2002:aa7:c80e:: with SMTP id a14mr8412414edt.295.1613989069569; Mon, 22 Feb 2021 02:17:49 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1613989069; cv=none; d=google.com; s=arc-20160816; b=ke7Bfpd1zrc0Fv/s22Yu4nGXCEHeWK6oPVhbYEN71n3sT1kRXvBWqHTPHkE3jo/Z6+ zuI+u/AMu8wCCsbNVfY+fRDQ0G6KwRdem9liaNVQssJgPJYQWcPBVC2jpAmmVag0FJ4J 9Qk4oRH8eUzYRP6jT1hb1UaYTLdtOxuWUNE08RPsV3/0RTggPDAVIzyD9ZXSVZl1M9+3 QuF3OASeyCR1n59tlI18vKsjfofQGbhL3RThLN0eU8owV9tfIdZkTKKYzefSswQfNatU o7wa1Hompml0u1g0EdjuF0rgG4GGBtB+BrNtCp/6qn1W2ENG1Y5HNWiMygsgrfnp2/XL ftVw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=NmAWPKWq66l00FCCrejdP2XiFUo/1pGKXex00WnYCIs=; b=AK/xCSB788iIarKy9etyap5c/j4lXyNfYNu+vB8xunJEMy65ljmF/KwQiX5Mrl7DVQ y6Cea90FZ26UQ13OgPgvu0LDeDO5zkkX1iRDtpstFDmebS+sgZfCBfTF2gAl67CDB4fl Jd0PmQKCP7+mwqQ6di16igO996AmAQm8NzTyOZXa1eiPZyJYmDYc00D/Uqu65XS8i+kr TIY7py9rjpZXnMkFzj6HpytMveRUbnXbRrogAHiRiyD9x6ZSrVXPMWOFalc+Rc11uHkf 6X6gSo2kg7lF0ijplq9DNB14zjnBFWIOq41T8JTLAEgEg5JTq/9+V0Zc8Pm0xyzkmAFd z9fg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id m22si10839802eje.468.2021.02.22.02.17.25; Mon, 22 Feb 2021 02:17:49 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231150AbhBVKOs (ORCPT + 99 others); Mon, 22 Feb 2021 05:14:48 -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