From: Peter Zijlstra <peterz@infradead.org>
To: Jens Axboe <axboe@kernel.dk>
Cc: linux-block@vger.kernel.org, mingo@kernel.org
Subject: Re: [PATCH 1/2] io-wq: small threadpool implementation for io_uring
Date: Mon, 28 Oct 2019 18:10:10 +0100 [thread overview]
Message-ID: <20191028171010.GH4114@hirez.programming.kicks-ass.net> (raw)
In-Reply-To: <20191025172251.12830-2-axboe@kernel.dk>
On Fri, Oct 25, 2019 at 11:22:50AM -0600, Jens Axboe wrote:
> include/linux/sched.h | 1 +
> kernel/sched/core.c | 16 +-
This all seems pretty harmless, it makes the wq paths wee bit slower,
but everything else should be unaffected.
Acked-by: Peter Zijlstra (Intel) <peterz@infradead.org>
> diff --git a/include/linux/sched.h b/include/linux/sched.h
> index 67a1d86981a9..6666e25606b7 100644
> --- a/include/linux/sched.h
> +++ b/include/linux/sched.h
> @@ -1468,6 +1468,7 @@ extern struct pid *cad_pid;
> #define PF_NO_SETAFFINITY 0x04000000 /* Userland is not allowed to meddle with cpus_mask */
> #define PF_MCE_EARLY 0x08000000 /* Early kill for mce process policy */
> #define PF_MEMALLOC_NOCMA 0x10000000 /* All allocation request will have _GFP_MOVABLE cleared */
> +#define PF_IO_WORKER 0x20000000 /* Task is an IO worker */
> #define PF_FREEZER_SKIP 0x40000000 /* Freezer should not count it as freezable */
> #define PF_SUSPEND_TASK 0x80000000 /* This thread called freeze_processes() and should not be frozen */
>
> diff --git a/kernel/sched/core.c b/kernel/sched/core.c
> index dd05a378631a..a95a2f05f3b5 100644
> --- a/kernel/sched/core.c
> +++ b/kernel/sched/core.c
> @@ -16,6 +16,7 @@
> #include <asm/tlb.h>
>
> #include "../workqueue_internal.h"
> +#include "../../fs/io-wq.h"
> #include "../smpboot.h"
>
> #include "pelt.h"
> @@ -4103,9 +4104,12 @@ static inline void sched_submit_work(struct task_struct *tsk)
> * we disable preemption to avoid it calling schedule() again
> * in the possible wakeup of a kworker.
> */
> - if (tsk->flags & PF_WQ_WORKER) {
> + if (tsk->flags & (PF_WQ_WORKER | PF_IO_WORKER)) {
> preempt_disable();
> - wq_worker_sleeping(tsk);
> + if (tsk->flags & PF_WQ_WORKER)
> + wq_worker_sleeping(tsk);
> + else
> + io_wq_worker_sleeping(tsk);
> preempt_enable_no_resched();
> }
>
> @@ -4122,8 +4126,12 @@ static inline void sched_submit_work(struct task_struct *tsk)
>
> static void sched_update_worker(struct task_struct *tsk)
> {
> - if (tsk->flags & PF_WQ_WORKER)
> - wq_worker_running(tsk);
> + if (tsk->flags & (PF_WQ_WORKER | PF_IO_WORKER)) {
> + if (tsk->flags & PF_WQ_WORKER)
> + wq_worker_running(tsk);
> + else
> + io_wq_worker_running(tsk);
> + }
> }
>
> asmlinkage __visible void __sched schedule(void)
> --
> 2.17.1
>
next prev parent reply other threads:[~2019-10-28 17:10 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-10-25 17:22 [PATCHSET v2 0/2] Replace io_uring workqueues with io-wq Jens Axboe
2019-10-25 17:22 ` [PATCH 1/2] io-wq: small threadpool implementation for io_uring Jens Axboe
2019-10-28 17:10 ` Peter Zijlstra [this message]
2019-10-28 21:21 ` Jens Axboe
2019-10-25 17:22 ` [PATCH 2/2] io_uring: replace workqueue usage with io-wq Jens Axboe
-- strict thread matches above, loose matches on Subject: below --
2019-10-24 13:44 [PATCHSET] Replace io_uring workqueues " Jens Axboe
2019-10-24 13:44 ` [PATCH 1/2] io-wq: small threadpool implementation for io_uring Jens Axboe
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=20191028171010.GH4114@hirez.programming.kicks-ass.net \
--to=peterz@infradead.org \
--cc=axboe@kernel.dk \
--cc=linux-block@vger.kernel.org \
--cc=mingo@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: link
Be 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.