From 088b103abfede1a92bd7b2c7f89a24cf71771bde Mon Sep 17 00:00:00 2001 From: Thomas Schoebel-Theuer Date: Wed, 17 May 2017 12:10:35 +0200 Subject: [PATCH] infra: avoid frequent resched --- kernel/brick.c | 2 +- kernel/brick_say.c | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/kernel/brick.c b/kernel/brick.c index 2e079941..db5d3f81 100644 --- a/kernel/brick.c +++ b/kernel/brick.c @@ -38,7 +38,7 @@ int _brick_msleep(int msecs, bool shorten) unsigned long timeout; flush_signals(current); \ if (msecs <= 0) { - schedule(); + cond_resched(); return 0; } timeout = msecs_to_jiffies(msecs) + 1; diff --git a/kernel/brick_say.c b/kernel/brick_say.c index 83992be9..1e652687 100644 --- a/kernel/brick_say.c +++ b/kernel/brick_say.c @@ -375,7 +375,7 @@ struct say_channel *_make_channel(const char *name, bool must_exist) restart: res = kzalloc(sizeof(struct say_channel), mode); if (unlikely(!res)) { - schedule(); + cond_resched(); goto restart; } atomic_inc(&say_alloc_channels); @@ -385,7 +385,7 @@ restart: restart2: res->ch_name = kstrdup(name, mode); if (unlikely(!res->ch_name)) { - schedule(); + cond_resched(); goto restart2; } atomic_inc(&say_alloc_names); @@ -396,7 +396,7 @@ restart2: restart3: buf = (void*)__get_free_pages(mode, SAY_ORDER); if (unlikely(!buf)) { - schedule(); + cond_resched(); goto restart3; } atomic_inc(&say_alloc_pages); @@ -688,7 +688,7 @@ char *_make_filename(struct say_channel *ch, int class, int transact, int add_tm restart: filename = kmalloc(1024, GFP_KERNEL); if (unlikely(!filename)) { - schedule(); + cond_resched(); goto restart; } atomic_inc(&say_alloc_names);