From: Tejun Heo <tj@kernel.org> To: Hao Xu <haoxu@linux.alibaba.com> Cc: Jens Axboe <axboe@kernel.dk>, Zefan Li <lizefan.x@bytedance.com>, 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 2/2] io_uring: consider cgroup setting when binding sqpoll cpu Date: Tue, 7 Sep 2021 06:54:42 -1000 [thread overview] Message-ID: <YTeZUnshr+mgf5GS@slm.duckdns.org> (raw) In-Reply-To: <c49d9b26-1c74-316a-c933-e6964695a286@linux.alibaba.com> Hello, On Fri, Sep 03, 2021 at 11:04:07PM +0800, Hao Xu wrote: > > Would it make sense to just test whether set_cpus_allowed_ptr() succeeded > > afterwards? > Do you mean: if (sqd->sq_cpu != -1 && !set_cpus_allowed_ptr(current, > cpumask_of(sqd->sq_cpu))) > > I'm not familiar with set_cpus_allowed_ptr(), you mean it contains the > similar logic of test_cpu_in_current_cpuset? It's kinda muddy unfortunately. I think it rejects if the target cpu is offline but accept and ignores if the cpu is excluded by cpuset. > This is a bit beyond of my knowledge, so you mean if the cpu back > online, the task will automatically schedule to this cpu? if it's true, > I think the code logic here is fine. > > > offline and online. If the operation takes place while the cpu happens to be > > offline, the operation fails. > It's ok that it fails, we leave the option of retry to users themselves. I think the first thing to do is defining the desired behavior, hopefully in a consistent manner, rather than letting it be defined by implementation. e.g. If the desired behavior is the per-cpu helper failing, then it should probably exit when the target cpu isn't available for whatever reason. If the desired behavior is best effort when cpu goes away (ie. ignore affinity), the creation likely shouldn't fail when the target cpu is unavailable but can become available in the future. Thanks. -- tejun
WARNING: multiple messages have this Message-ID (diff)
From: Tejun Heo <tj-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org> To: Hao Xu <haoxu-KPsoFbNs7GizrGE5bRqYAgC/G2K4zDHf@public.gmane.org> Cc: Jens Axboe <axboe-tSWWG44O7X1aa/9Udqfwiw@public.gmane.org>, Zefan Li <lizefan.x-EC8Uxl6Npydl57MIdRCFDg@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 2/2] io_uring: consider cgroup setting when binding sqpoll cpu Date: Tue, 7 Sep 2021 06:54:42 -1000 [thread overview] Message-ID: <YTeZUnshr+mgf5GS@slm.duckdns.org> (raw) In-Reply-To: <c49d9b26-1c74-316a-c933-e6964695a286-KPsoFbNs7GizrGE5bRqYAgC/G2K4zDHf@public.gmane.org> Hello, On Fri, Sep 03, 2021 at 11:04:07PM +0800, Hao Xu wrote: > > Would it make sense to just test whether set_cpus_allowed_ptr() succeeded > > afterwards? > Do you mean: if (sqd->sq_cpu != -1 && !set_cpus_allowed_ptr(current, > cpumask_of(sqd->sq_cpu))) > > I'm not familiar with set_cpus_allowed_ptr(), you mean it contains the > similar logic of test_cpu_in_current_cpuset? It's kinda muddy unfortunately. I think it rejects if the target cpu is offline but accept and ignores if the cpu is excluded by cpuset. > This is a bit beyond of my knowledge, so you mean if the cpu back > online, the task will automatically schedule to this cpu? if it's true, > I think the code logic here is fine. > > > offline and online. If the operation takes place while the cpu happens to be > > offline, the operation fails. > It's ok that it fails, we leave the option of retry to users themselves. I think the first thing to do is defining the desired behavior, hopefully in a consistent manner, rather than letting it be defined by implementation. e.g. If the desired behavior is the per-cpu helper failing, then it should probably exit when the target cpu isn't available for whatever reason. If the desired behavior is best effort when cpu goes away (ie. ignore affinity), the creation likely shouldn't fail when the target cpu is unavailable but can become available in the future. Thanks. -- tejun
next prev parent reply other threads:[~2021-09-07 16:54 UTC|newest] Thread overview: 23+ 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 [this message] 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ý 2021-09-09 12:34 ` Michal Koutný 2021-09-03 14:43 ` Hao Xu -- strict thread matches above, loose matches on Subject: below -- 2021-09-01 10:18 [PATCH v3 " Hao Xu 2021-09-01 10:18 ` [PATCH 2/2] io_uring: consider cgroup setting when binding sqpoll cpu Hao Xu 2021-09-01 10:18 ` Hao Xu 2021-09-01 12:31 ` 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=YTeZUnshr+mgf5GS@slm.duckdns.org \ --to=tj@kernel.org \ --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 \ /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.