From: Jens Axboe <axboe@kernel.dk> To: "Michal Koutný" <mkoutny@suse.com>, "Hao Xu" <haoxu@linux.alibaba.com> Cc: Zefan Li <lizefan.x@bytedance.com>, Tejun Heo <tj@kernel.org>, Johannes Weiner <hannes@cmpxchg.org>, Pavel Begunkov <asml.silence@gmail.com>, io-uring@vger.kernel.org, cgroups@vger.kernel.org, Joseph Qi <joseph.qi@linux.alibaba.com> Subject: Re: [PATCH v4 0/2] refactor sqthread cpu binding logic Date: Thu, 2 Sep 2021 12:00:33 -0600 [thread overview] Message-ID: <efd3c387-9c7c-c0d8-1306-f722da2a9ba1@kernel.dk> (raw) In-Reply-To: <20210902164808.GA10014@blackbody.suse.cz> On 9/2/21 10:48 AM, Michal Koutný wrote: > Hello Hao. > > On Wed, Sep 01, 2021 at 08:43:20PM +0800, Hao Xu <haoxu@linux.alibaba.com> wrote: >> This patchset is to enhance sqthread cpu binding logic, we didn't >> consider cgroup setting before. In container environment, theoretically >> sqthread is in its container's task group, it shouldn't occupy cpu out >> of its container. > > I see in the discussions that there's struggle to make > set_cpus_allowed_ptr() do what's intended under the given constraints. > > IIUC, set_cpus_allowed_ptr() is conventionally used for kernel threads > [1]. But does the sqthread fall into this category? You want to have it > _directly_ associated with a container and its cgroups. It looks to me > more like a userspace thread (from this perspective, not literally). Or > is there a different intention? It's an io thread, which is kind of a hybrid - it's a kernel thread in the sense that it never exits to userspace (ever), but it's a regular thread in the sense that it's setup like one. > It seems to me that reusing the sched_setaffinity() (with all its > checks and race pains/solutions) would be a more universal approach. > (I don't mean calling sched_setaffinity() directly, some parts would > need to be factored separately to this end.) WDYT? We already have this API to set the affinity based on when these were regular kernel threads, so it needs to work with that too. As such they are marked PF_NO_SETAFFINITY. > [1] Not only spending their life in kernel but providing some > delocalized kernel service. That's what they do... -- Jens Axboe
next prev parent reply other threads:[~2021-09-02 18:00 UTC|newest] Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top 2021-09-01 12:43 Hao Xu 2021-09-01 12:43 ` [PATCH 1/2] cpuset: add a helper to check if cpu in cpuset of current task Hao Xu 2021-09-01 12:43 ` [PATCH 2/2] io_uring: consider cgroup setting when binding sqpoll cpu Hao Xu 2021-09-01 16:41 ` Tejun Heo 2021-09-01 16:42 ` Tejun Heo 2021-09-03 15:04 ` Hao Xu 2021-09-07 16:54 ` Tejun Heo 2021-09-07 19:28 ` Hao Xu 2021-09-02 16:48 ` [PATCH v4 0/2] refactor sqthread cpu binding logic Michal Koutný 2021-09-02 18:00 ` Jens Axboe [this message] 2021-09-09 12:34 ` Michal Koutný 2021-09-03 14:43 ` Hao Xu
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=efd3c387-9c7c-c0d8-1306-f722da2a9ba1@kernel.dk \ --to=axboe@kernel.dk \ --cc=asml.silence@gmail.com \ --cc=cgroups@vger.kernel.org \ --cc=hannes@cmpxchg.org \ --cc=haoxu@linux.alibaba.com \ --cc=io-uring@vger.kernel.org \ --cc=joseph.qi@linux.alibaba.com \ --cc=lizefan.x@bytedance.com \ --cc=mkoutny@suse.com \ --cc=tj@kernel.org \ --subject='Re: [PATCH v4 0/2] refactor sqthread cpu binding logic' \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: link
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).