Skip to content

Commit

Permalink
drbd: use sched_setscheduler()
Browse files Browse the repository at this point in the history
It was unnoticed for some time that assigning to current->policy is
no longer sufficient to set a real time priority for a kernel thread.

Reported-by: Charlie Suffin <Charlie.Suffin@stratus.com>
Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
  • Loading branch information
Philipp Reisner authored and Jens Axboe committed Mar 28, 2013
1 parent 7c689e6 commit 3990e04
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
6 changes: 4 additions & 2 deletions drivers/block/drbd/drbd_receiver.c
Original file line number Diff line number Diff line change
Expand Up @@ -5257,9 +5257,11 @@ int drbd_asender(struct drbd_thread *thi)
bool ping_timeout_active = false;
struct net_conf *nc;
int ping_timeo, tcp_cork, ping_int;
struct sched_param param = { .sched_priority = 2 };

current->policy = SCHED_RR; /* Make this a realtime task! */
current->rt_priority = 2; /* more important than all other tasks */
rv = sched_setscheduler(current, SCHED_RR, &param);
if (rv < 0)
conn_err(tconn, "drbd_asender: ERROR set priority, ret=%d\n", rv);

while (get_t_state(thi) == RUNNING) {
drbd_thread_current_set_cpu(thi);
Expand Down
2 changes: 1 addition & 1 deletion include/linux/drbd.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
#endif

extern const char *drbd_buildtag(void);
#define REL_VERSION "8.4.2"
#define REL_VERSION "8.4.3"
#define API_VERSION 1
#define PRO_VERSION_MIN 86
#define PRO_VERSION_MAX 101
Expand Down

0 comments on commit 3990e04

Please sign in to comment.