From: Jens Axboe <axboe@kernel.dk>
To: linux-kernel@vger.kernel.org
Cc: peterz@infradead.org, tglx@linutronix.de, Jens Axboe <axboe@kernel.dk>
Subject: [PATCH 3/4] sched/core: have io_schedule_prepare() return a long
Date: Mon, 19 Aug 2024 09:39:48 -0600 [thread overview]
Message-ID: <20240819154259.215504-4-axboe@kernel.dk> (raw)
In-Reply-To: <20240819154259.215504-1-axboe@kernel.dk>
In preparation for needing more state then 32-bit on 64-bit archs,
switch it to a long instead.
Signed-off-by: Jens Axboe <axboe@kernel.dk>
---
block/blk-cgroup.c | 2 +-
include/linux/sched.h | 4 ++--
kernel/locking/mutex.c | 4 ++--
kernel/locking/rtmutex_api.c | 4 ++--
kernel/sched/core.c | 6 +++---
5 files changed, 10 insertions(+), 10 deletions(-)
diff --git a/block/blk-cgroup.c b/block/blk-cgroup.c
index 69e70964398c..f8e6220c66a7 100644
--- a/block/blk-cgroup.c
+++ b/block/blk-cgroup.c
@@ -1884,7 +1884,7 @@ static void blkcg_maybe_throttle_blkg(struct blkcg_gq *blkg, bool use_memdelay)
u64 now = blk_time_get_ns();
u64 exp;
u64 delay_nsec = 0;
- int tok;
+ long tok;
while (blkg->parent) {
int use_delay = atomic_read(&blkg->use_delay);
diff --git a/include/linux/sched.h b/include/linux/sched.h
index 2c1b4ee3234f..c1a65e19a3ac 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -319,8 +319,8 @@ asmlinkage void preempt_schedule_irq(void);
extern void schedule_rtlock(void);
#endif
-extern int __must_check io_schedule_prepare(void);
-extern void io_schedule_finish(int token);
+extern long __must_check io_schedule_prepare(void);
+extern void io_schedule_finish(long token);
extern long io_schedule_timeout(long timeout);
extern void io_schedule(void);
diff --git a/kernel/locking/mutex.c b/kernel/locking/mutex.c
index cbae8c0b89ab..4a86ea6c7f19 100644
--- a/kernel/locking/mutex.c
+++ b/kernel/locking/mutex.c
@@ -830,7 +830,7 @@ EXPORT_SYMBOL_GPL(mutex_lock_interruptible_nested);
void __sched
mutex_lock_io_nested(struct mutex *lock, unsigned int subclass)
{
- int token;
+ long token;
might_sleep();
@@ -1026,7 +1026,7 @@ EXPORT_SYMBOL(mutex_lock_killable);
*/
void __sched mutex_lock_io(struct mutex *lock)
{
- int token;
+ long token;
token = io_schedule_prepare();
mutex_lock(lock);
diff --git a/kernel/locking/rtmutex_api.c b/kernel/locking/rtmutex_api.c
index a6974d044593..ddf7f7f3f0b5 100644
--- a/kernel/locking/rtmutex_api.c
+++ b/kernel/locking/rtmutex_api.c
@@ -547,7 +547,7 @@ EXPORT_SYMBOL_GPL(mutex_lock_killable_nested);
void __sched mutex_lock_io_nested(struct mutex *lock, unsigned int subclass)
{
- int token;
+ long token;
might_sleep();
@@ -579,7 +579,7 @@ EXPORT_SYMBOL(mutex_lock_killable);
void __sched mutex_lock_io(struct mutex *lock)
{
- int token = io_schedule_prepare();
+ long token = io_schedule_prepare();
__mutex_lock_common(lock, TASK_UNINTERRUPTIBLE, 0, NULL, _RET_IP_);
io_schedule_finish(token);
diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index 7e04b84dcc55..d6c494e33206 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -7415,16 +7415,16 @@ static inline void preempt_dynamic_init(void) { }
#endif /* CONFIG_PREEMPT_DYNAMIC */
-int io_schedule_prepare(void)
+long io_schedule_prepare(void)
{
- int old_iowait = current->in_iowait;
+ long old_iowait = current->in_iowait;
current->in_iowait = 1;
blk_flush_plug(current->plug, true);
return old_iowait;
}
-void io_schedule_finish(int token)
+void io_schedule_finish(long token)
{
current->in_iowait = token;
}
--
2.43.0
next prev parent reply other threads:[~2024-08-19 15:43 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-08-19 15:39 [PATCHSET v6 0/4] Split iowait into two states Jens Axboe
2024-08-19 15:39 ` [PATCH 1/4] sched/core: add helpers for iowait handling Jens Axboe
2024-08-19 15:39 ` [PATCH 2/4] sched/core: change rq->nr_iowait type to atomic_long_t Jens Axboe
2024-08-20 2:14 ` Zhang Qiao
2024-08-19 15:39 ` Jens Axboe [this message]
2024-09-05 9:57 ` [PATCH 3/4] sched/core: have io_schedule_prepare() return a long Peter Zijlstra
2024-08-19 15:39 ` [PATCH 4/4] sched/core: split iowait state into two states Jens Axboe
2024-09-05 10:55 ` Peter Zijlstra
2024-08-21 14:54 ` [PATCHSET v6 0/4] Split iowait " Christian Loehle
2024-08-21 15:04 ` Jens Axboe
2024-08-21 15:57 ` Christian Loehle
2024-08-24 15:34 ` Jens Axboe
2024-09-04 14:28 ` Peter Zijlstra
2024-09-04 14:41 ` Jens Axboe
2024-09-04 14:49 ` Jens Axboe
2024-09-05 9:51 ` Peter Zijlstra
2024-09-04 14:42 ` Rafael J. Wysocki
2024-09-04 15:18 ` Rafael J. Wysocki
2024-09-05 9:29 ` Christian Loehle
2024-09-05 10:40 ` Rafael J. Wysocki
2024-09-05 9:36 ` Peter Zijlstra
2024-09-05 10:31 ` Christian Loehle
2024-09-05 11:00 ` Peter Zijlstra
2024-09-05 11:09 ` Christian Loehle
2025-03-31 9:02 ` Pavel Begunkov
2025-03-31 10:33 ` Christian Loehle
2025-04-01 8:21 ` Pavel Begunkov
-- strict thread matches above, loose matches on Subject: below --
2024-08-17 20:45 [PATCHSET v5 " Jens Axboe
2024-08-17 20:45 ` [PATCH 3/4] sched/core: have io_schedule_prepare() return a long Jens Axboe
2024-04-16 12:11 [PATCHSET v4 0/4] Split iowait into two states Jens Axboe
2024-04-16 12:11 ` [PATCH 3/4] sched/core: have io_schedule_prepare() return a long 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=20240819154259.215504-4-axboe@kernel.dk \
--to=axboe@kernel.dk \
--cc=linux-kernel@vger.kernel.org \
--cc=peterz@infradead.org \
--cc=tglx@linutronix.de \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox