From: "Michal Koutný" <mkoutny@suse.com> To: Jens Axboe <axboe@kernel.dk>, 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, 9 Sep 2021 14:34:05 +0200 [thread overview] Message-ID: <20210909123405.GA7872@blackbody.suse.cz> (raw) In-Reply-To: <efd3c387-9c7c-c0d8-1306-f722da2a9ba1@kernel.dk> Thanks for the answer and the context explanations. On Thu, Sep 02, 2021 at 12:00:33PM -0600, Jens Axboe <axboe@kernel.dk> wrote: > 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. I see the current implementation "allows" at most one binding (by the passed sq_cpu arg) to a CPU and then "locks" it by setting PF_NO_SETAFFINITY subsequently (after set_cpus_allowed_ptr). And actually doesn't check whether it succeeded or not (Hao suggests in another subthread sq_cpu is a mere hint). Nevertheless, you likely don't want to "trespass" the boundary of a cpuset and I think that it'll end up with a loop checking against hotplug races. That is already implemented in __sched_affinity, it'd be IMO good to have it in one place only. > > [1] Not only spending their life in kernel but providing some > > delocalized kernel service. > > That's what they do... (I assume that answer to "life in kernel" and the IO threads serve only the originating cpuset (container) i.e. are (co)localized to it (not delocalized as some kernel workers).) Cheers, Michal
WARNING: multiple messages have this Message-ID (diff)
From: "Michal Koutný" <mkoutny-IBi9RG/b67k@public.gmane.org> To: Jens Axboe <axboe-tSWWG44O7X1aa/9Udqfwiw@public.gmane.org>, Hao Xu <haoxu-KPsoFbNs7GizrGE5bRqYAgC/G2K4zDHf@public.gmane.org> Cc: Zefan Li <lizefan.x-EC8Uxl6Npydl57MIdRCFDg@public.gmane.org>, Tejun Heo <tj-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>, Johannes Weiner <hannes-druUgvl0LCNAfugRpC6u6w@public.gmane.org>, Pavel Begunkov <asml.silence-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>, io-uring-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, cgroups-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, Joseph Qi <joseph.qi-KPsoFbNs7GizrGE5bRqYAgC/G2K4zDHf@public.gmane.org> Subject: Re: [PATCH v4 0/2] refactor sqthread cpu binding logic Date: Thu, 9 Sep 2021 14:34:05 +0200 [thread overview] Message-ID: <20210909123405.GA7872@blackbody.suse.cz> (raw) In-Reply-To: <efd3c387-9c7c-c0d8-1306-f722da2a9ba1-tSWWG44O7X1aa/9Udqfwiw@public.gmane.org> Thanks for the answer and the context explanations. On Thu, Sep 02, 2021 at 12:00:33PM -0600, Jens Axboe <axboe-tSWWG44O7X1aa/9Udqfwiw@public.gmane.org> wrote: > 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. I see the current implementation "allows" at most one binding (by the passed sq_cpu arg) to a CPU and then "locks" it by setting PF_NO_SETAFFINITY subsequently (after set_cpus_allowed_ptr). And actually doesn't check whether it succeeded or not (Hao suggests in another subthread sq_cpu is a mere hint). Nevertheless, you likely don't want to "trespass" the boundary of a cpuset and I think that it'll end up with a loop checking against hotplug races. That is already implemented in __sched_affinity, it'd be IMO good to have it in one place only. > > [1] Not only spending their life in kernel but providing some > > delocalized kernel service. > > That's what they do... (I assume that answer to "life in kernel" and the IO threads serve only the originating cpuset (container) i.e. are (co)localized to it (not delocalized as some kernel workers).) Cheers, Michal
next prev parent reply other threads:[~2021-09-09 12:40 UTC|newest] Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top 2021-09-01 12:43 [PATCH v4 0/2] refactor sqthread cpu binding logic 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 ` Hao Xu 2021-09-01 12:43 ` [PATCH 2/2] io_uring: consider cgroup setting when binding sqpoll cpu Hao Xu 2021-09-01 12:43 ` Hao Xu 2021-09-01 16:41 ` Tejun Heo 2021-09-01 16:41 ` Tejun Heo 2021-09-01 16:42 ` Tejun Heo 2021-09-03 15:04 ` Hao Xu 2021-09-03 15:04 ` Hao Xu 2021-09-07 16:54 ` Tejun Heo 2021-09-07 16:54 ` Tejun Heo 2021-09-07 19:28 ` Hao Xu 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 2021-09-02 18:00 ` Jens Axboe 2021-09-09 12:34 ` Michal Koutný [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=20210909123405.GA7872@blackbody.suse.cz \ --to=mkoutny@suse.com \ --cc=asml.silence@gmail.com \ --cc=axboe@kernel.dk \ --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=tj@kernel.org \ /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: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.