@@ -266,7 +266,6 @@ static int agent_thread_fn(void *data)
{
while (1) {
wait_event_interruptible(agent_wq, pci_pm_state >= 2);
- try_to_freeze();
if (signal_pending(current) || pci_pm_state < 2)
continue;
@@ -662,9 +662,7 @@ static int kopald(void *unused)
{
__be64 events;
- set_freezable();
do {
- try_to_freeze();
opal_poll_events(&events);
opal_handle_events(be64_to_cpu(events));
msleep_interruptible(opal_heartbeat);
@@ -843,7 +843,6 @@ static int ps3_probe_thread(void *data)
/* Loop here processing the requested notification events. */
do {
- try_to_freeze();
memset(notify_event, 0, sizeof(*notify_event));
@@ -148,8 +148,6 @@ static int power_saving_thread(void *data)
while (!kthread_should_stop()) {
unsigned long expire_time;
- try_to_freeze();
-
/* round robin to cpus */
expire_time = last_jiffies + round_robin_time * HZ;
if (time_before(expire_time, jiffies)) {
@@ -2202,13 +2202,13 @@ retry:
if (!binder_has_proc_work(proc, thread))
ret = -EAGAIN;
} else
- ret = wait_event_freezable_exclusive(proc->wait, binder_has_proc_work(proc, thread));
+ ret = wait_event_interruptible_exclusive(proc->wait, binder_has_proc_work(proc, thread));
} else {
if (non_block) {
if (!binder_has_thread_work(thread))
ret = -EAGAIN;
} else
- ret = wait_event_freezable(thread->wait, binder_has_thread_work(thread));
+ ret = wait_event_interruptible(thread->wait, binder_has_thread_work(thread));
}
binder_lock(__func__);
@@ -1466,7 +1466,6 @@ static int kcdrwd(void *foobar)
long min_sleep_time, residue;
set_user_nice(current, MIN_NICE);
- set_freezable();
for (;;) {
DECLARE_WAITQUEUE(wait, current);
@@ -1511,9 +1510,6 @@ static int kcdrwd(void *foobar)
residue = schedule_timeout(min_sleep_time);
pkt_dbg(2, pd, "wake up\n");
- /* make swsusp happy with our thread */
- try_to_freeze();
-
list_for_each_entry(pkt, &pd->cdrw.pkt_active_list, list) {
if (!pkt->sleep_time)
continue;
@@ -598,8 +598,6 @@ int xen_blkif_schedule(void *arg)
xen_blkif_get(blkif);
while (!kthread_should_stop()) {
- if (try_to_freeze())
- continue;
if (unlikely(vbd->size != vbd_sz(vbd)))
xen_vbd_resize(blkif);
@@ -316,7 +316,7 @@ static unsigned int dmatest_verify(u8 **bufs, unsigned int start,
return error_count;
}
-/* poor man's completion - we want to use wait_event_freezable() on it */
+/* poor man's completion - we want to use wait_event_interruptible() on it */
struct dmatest_done {
bool done;
wait_queue_head_t *wait;
@@ -420,8 +420,6 @@ static int dmatest_func(void *data)
s64 runtime = 0;
unsigned long long total_len = 0;
- set_freezable();
-
ret = -ENOMEM;
smp_rmb();
@@ -620,7 +618,7 @@ static int dmatest_func(void *data)
}
dma_async_issue_pending(chan);
- wait_event_freezable_timeout(done_wait, done.done,
+ wait_event_interruptible_timeout(done_wait, done.done,
msecs_to_jiffies(params->timeout));
status = dma_async_is_tx_complete(chan, cookie, NULL, NULL);
@@ -282,9 +282,7 @@ static int monitor_task(void *arg)
{
struct thermostat* th = arg;
- set_freezable();
while(!kthread_should_stop()) {
- try_to_freeze();
msleep_interruptible(2000);
#ifndef DEBUG
@@ -93,9 +93,7 @@ static int wf_thread_func(void *data)
DBG("wf: thread started\n");
- set_freezable();
while (!kthread_should_stop()) {
- try_to_freeze();
if (time_after_eq(jiffies, next)) {
wf_notify(WF_EVENT_TICK, NULL);
@@ -288,7 +288,6 @@ do { \
if (kthread_should_stop()) \
return 0; \
\
- try_to_freeze(); \
schedule(); \
mutex_lock(&(ca)->set->bucket_lock); \
} \
@@ -1786,7 +1786,6 @@ again:
mutex_unlock(&c->bucket_lock);
- try_to_freeze();
schedule();
}
@@ -228,7 +228,6 @@ static void read_dirty(struct cached_dev *dc)
*/
while (!kthread_should_stop()) {
- try_to_freeze();
w = bch_keybuf_next(&dc->writeback_keys);
if (!w)
@@ -410,7 +409,6 @@ static int bch_writeback_thread(void *arg)
if (kthread_should_stop())
return 0;
- try_to_freeze();
schedule();
continue;
}
@@ -397,13 +397,11 @@ next:
continue;
}
- if (!try_to_freeze()) {
- set_current_state(TASK_INTERRUPTIBLE);
- if (!kthread_should_stop() &&
- !atomic_read(&lc->pending_blocks))
- schedule();
- __set_current_state(TASK_RUNNING);
- }
+ set_current_state(TASK_INTERRUPTIBLE);
+ if (!kthread_should_stop() &&
+ !atomic_read(&lc->pending_blocks))
+ schedule();
+ __set_current_state(TASK_RUNNING);
}
return 0;
}
@@ -725,7 +725,6 @@ static int dvb_frontend_thread(void *data)
dvb_frontend_init(fe);
- set_freezable();
while (1) {
up(&fepriv->sem); /* is locked when we enter the thread... */
restart:
@@ -742,9 +741,6 @@ restart:
break;
}
- if (try_to_freeze())
- goto restart;
-
if (down_interruptible(&fepriv->sem))
break;
@@ -339,7 +339,6 @@ int msp_sleep(struct msp_state *state, int timeout)
}
remove_wait_queue(&state->wq, &wait);
- try_to_freeze();
return state->restart;
}
@@ -510,7 +510,6 @@ int msp3400c_thread(void *data)
v4l_dbg(1, msp_debug, client, "msp3400 daemon started\n");
state->detected_std = V4L2_STD_ALL;
- set_freezable();
for (;;) {
v4l_dbg(2, msp_debug, client, "msp3400 thread: sleep\n");
msp_sleep(state, -1);
@@ -700,7 +699,6 @@ int msp3410d_thread(void *data)
v4l_dbg(1, msp_debug, client, "msp3410 daemon started\n");
state->detected_std = V4L2_STD_ALL;
- set_freezable();
for (;;) {
v4l_dbg(2, msp_debug, client, "msp3410 thread: sleep\n");
msp_sleep(state, -1);
@@ -998,7 +996,6 @@ int msp34xxg_thread(void *data)
v4l_dbg(1, msp_debug, client, "msp34xxg daemon started\n");
state->detected_std = V4L2_STD_ALL;
- set_freezable();
for (;;) {
v4l_dbg(2, msp_debug, client, "msp34xxg thread: sleep\n");
msp_sleep(state, -1);
@@ -314,13 +314,11 @@ static int chip_thread(void *data)
int mode, selected;
v4l2_dbg(1, debug, sd, "thread started\n");
- set_freezable();
for (;;) {
set_current_state(TASK_INTERRUPTIBLE);
if (!kthread_should_stop())
schedule();
set_current_state(TASK_RUNNING);
- try_to_freeze();
if (kthread_should_stop())
break;
v4l2_dbg(1, debug, sd, "thread wakeup\n");
@@ -992,12 +992,10 @@ int cx88_audio_thread(void *data)
u32 mode = 0;
dprintk("cx88: tvaudio thread started\n");
- set_freezable();
for (;;) {
msleep_interruptible(1000);
if (kthread_should_stop())
break;
- try_to_freeze();
switch (core->tvaudio) {
case WW_BG:
@@ -317,10 +317,8 @@ static int pt1_thread(void *data)
struct pt1_buffer_page *page;
pt1 = data;
- set_freezable();
while (!kthread_should_stop()) {
- try_to_freeze();
page = pt1->tables[pt1->table_index].bufs[pt1->buf_index].page;
if (!pt1_filter(pt1, page)) {
@@ -455,7 +455,6 @@ static int pt3_fetch_thread(void *data)
dev_dbg(adap->dvb_adap.device, "PT3: [%s] started\n",
adap->thread->comm);
- set_freezable();
while (!kthread_freezable_should_stop(&was_frozen)) {
if (was_frozen)
adap->num_discard = PT3_INITIAL_BUF_DROPS;
@@ -477,15 +477,12 @@ static int tvaudio_thread(void *data)
unsigned int i, audio, nscan;
int max1,max2,carrier,rx,mode,lastmode,default_carrier;
- set_freezable();
-
for (;;) {
tvaudio_sleep(dev,-1);
if (kthread_should_stop())
goto done;
restart:
- try_to_freeze();
dev->thread.scan1 = dev->thread.scan2;
audio_dbg(1, "tvaudio thread scan start [%d]\n",
@@ -596,8 +593,6 @@ static int tvaudio_thread(void *data)
lastmode = 42;
for (;;) {
- try_to_freeze();
-
if (tvaudio_sleep(dev,5000))
goto restart;
if (kthread_should_stop())
@@ -774,14 +769,11 @@ static int tvaudio_thread_ddep(void *data)
struct saa7134_dev *dev = data;
u32 value, norms;
- set_freezable();
for (;;) {
tvaudio_sleep(dev,-1);
if (kthread_should_stop())
goto done;
restart:
- try_to_freeze();
-
dev->thread.scan1 = dev->thread.scan2;
audio_dbg(1, "tvaudio thread scan start [%d]\n",
dev->thread.scan1);
@@ -1164,13 +1164,10 @@ static int saa7164_thread_function(void *data)
dprintk(DBGLVL_THR, "thread started\n");
- set_freezable();
-
while (1) {
msleep_interruptible(100);
if (kthread_should_stop())
break;
- try_to_freeze();
dprintk(DBGLVL_THR, "thread running\n");
@@ -641,7 +641,6 @@ static int solo_ring_thread(void *data)
struct solo_dev *solo_dev = data;
DECLARE_WAITQUEUE(wait, current);
- set_freezable();
add_wait_queue(&solo_dev->ring_thread_wait, &wait);
for (;;) {
@@ -650,7 +649,6 @@ static int solo_ring_thread(void *data)
if (timeout == -ERESTARTSYS || kthread_should_stop())
break;
solo_handle_ring(solo_dev);
- try_to_freeze();
}
remove_wait_queue(&solo_dev->ring_thread_wait, &wait);
@@ -268,7 +268,6 @@ static int solo_thread(void *data)
struct solo_dev *solo_dev = data;
DECLARE_WAITQUEUE(wait, current);
- set_freezable();
add_wait_queue(&solo_dev->disp_thread_wait, &wait);
for (;;) {
@@ -277,7 +276,6 @@ static int solo_thread(void *data)
if (timeout == -ERESTARTSYS || kthread_should_stop())
break;
solo_thread_try(solo_dev);
- try_to_freeze();
}
remove_wait_queue(&solo_dev->disp_thread_wait, &wait);
@@ -745,8 +745,6 @@ static int vivid_thread_vid_cap(void *data)
dprintk(dev, 1, "Video Capture Thread Start\n");
- set_freezable();
-
/* Resets frame counters */
dev->cap_seq_offset = 0;
dev->cap_seq_count = 0;
@@ -754,7 +752,6 @@ static int vivid_thread_vid_cap(void *data)
dev->jiffies_vid_cap = jiffies;
for (;;) {
- try_to_freeze();
if (kthread_should_stop())
break;
@@ -132,8 +132,6 @@ static int vivid_thread_vid_out(void *data)
dprintk(dev, 1, "Video Output Thread Start\n");
- set_freezable();
-
/* Resets frame counters */
dev->out_seq_offset = 0;
if (dev->seq_wrap)
@@ -143,7 +141,6 @@ static int vivid_thread_vid_out(void *data)
dev->out_seq_resync = false;
for (;;) {
- try_to_freeze();
if (kthread_should_stop())
break;
@@ -136,8 +136,6 @@ static int vivid_thread_sdr_cap(void *data)
dprintk(dev, 1, "SDR Capture Thread Start\n");
- set_freezable();
-
/* Resets frame counters */
dev->sdr_cap_seq_offset = 0;
if (dev->seq_wrap)
@@ -146,7 +144,6 @@ static int vivid_thread_sdr_cap(void *data)
dev->sdr_cap_seq_resync = false;
for (;;) {
- try_to_freeze();
if (kthread_should_stop())
break;
@@ -39,16 +39,12 @@ static int pvr2_dvb_feed_func(struct pvr2_dvb_adapter *adap)
struct pvr2_stream *stream;
pvr2_trace(PVR2_TRACE_DVB_FEED, "dvb feed thread started");
- set_freezable();
stream = adap->channel.stream->stream;
for (;;) {
if (kthread_should_stop()) break;
- /* Not sure about this... */
- try_to_freeze();
-
bp = pvr2_stream_get_ready_buffer(stream);
if (bp != NULL) {
count = pvr2_buffer_get_count(bp);
@@ -48,7 +48,6 @@ static int videobuf_dvb_thread(void *data)
void *outp;
dprintk("dvb thread started\n");
- set_freezable();
videobuf_read_start(&dvb->dvbq);
for (;;) {
@@ -63,7 +62,6 @@ static int videobuf_dvb_thread(void *data)
break;
if (kthread_should_stop())
break;
- try_to_freeze();
/* feed buffer data to demux */
outp = videobuf_queue_to_vaddr(&dvb->dvbq, buf);
@@ -3212,8 +3212,6 @@ static int vb2_thread(void *data)
V4L2_BUF_FLAG_TIMESTAMP_COPY;
}
- set_freezable();
-
for (;;) {
struct vb2_buffer *vb;
@@ -3235,7 +3233,6 @@ static int vb2_thread(void *data)
}
if (ret || threadio->stop)
break;
- try_to_freeze();
vb = q->bufs[fileio->b.index];
if (!(fileio->b.flags & V4L2_BUF_FLAG_ERROR))
@@ -211,7 +211,6 @@ static int ucb1x00_thread(void *_ts)
bool frozen, ignore = false;
int valid = 0;
- set_freezable();
add_wait_queue(&ts->irq_wait, &wait);
while (!kthread_freezable_should_stop(&frozen)) {
unsigned int x, y, p;
@@ -1415,16 +1415,12 @@ int ubi_thread(void *u)
ubi_msg(ubi, "background thread \"%s\" started, PID %d",
ubi->bgt_name, task_pid_nr(current));
- set_freezable();
for (;;) {
int err;
if (kthread_should_stop())
break;
- if (try_to_freeze())
- continue;
-
spin_lock(&ubi->wl_lock);
if (list_empty(&ubi->works) || ubi->ro_mode ||
!ubi->thread_enabled || ubi_dbg_is_bgt_disabled(ubi)) {
@@ -747,8 +747,6 @@ static int stir_transmit_thread(void *arg)
write_reg(stir, REG_CTRL1, CTRL1_TXPWD|CTRL1_RXPWD);
- try_to_freeze();
-
if (change_speed(stir, stir->speed))
break;
}
@@ -3062,10 +3062,8 @@ static int airo_thread(void *data) {
struct airo_info *ai = dev->ml_priv;
int locked;
- set_freezable();
while(1) {
/* make swsusp happy with our thread */
- try_to_freeze();
if (test_bit(JOB_DIE, &ai->jobs))
break;
@@ -615,7 +615,6 @@ static int pccardd(void *__skt)
/* wait for userspace to catch up */
msleep(250);
- set_freezable();
for (;;) {
unsigned long flags;
unsigned int events;
@@ -675,7 +674,6 @@ static int pccardd(void *__skt)
/* make sure we are running */
__set_current_state(TASK_RUNNING);
- try_to_freeze();
}
/* shut down socket, if a device is still present */
@@ -2485,8 +2485,6 @@ static int hotkey_kthread(void *data)
if (tpacpi_lifecycle == TPACPI_LIFE_EXITING)
goto exit;
- set_freezable();
-
so = 0;
si = 1;
t = 0;
@@ -153,7 +153,6 @@ static int pnp_dock_thread(void *unused)
static struct pnp_docking_station_info now;
int docked = -1, d = 0;
- set_freezable();
while (1) {
int status;
@@ -162,9 +161,6 @@ static int pnp_dock_thread(void *unused)
*/
msleep_interruptible(2000);
- if (try_to_freeze())
- continue;
-
status = pnp_bios_dock_station_info(&now);
switch (status) {
@@ -218,11 +218,8 @@ static struct tps65090_platform_data *
static int tps65090_charger_poll_task(void *data)
{
- set_freezable();
-
while (!kthread_should_stop()) {
schedule_timeout_interruptible(POLL_INTERVAL);
- try_to_freeze();
tps65090_charger_isr(-1, data);
}
return 0;
@@ -229,7 +229,7 @@ static int ion_heap_deferred_free(void *data)
while (true) {
struct ion_buffer *buffer;
- wait_event_freezable(heap->waitqueue,
+ wait_event_interruptible(heap->waitqueue,
ion_heap_freelist_size(heap) > 0);
spin_lock(&heap->free_lock);
@@ -379,7 +379,6 @@ static int clamp_thread(void *arg)
unsigned int target_ratio;
set_bit(cpunr, cpu_clamping_mask);
- set_freezable();
init_timer_on_stack(&wakeup_timer);
sched_setscheduler(current, SCHED_FIFO, ¶m);
@@ -393,7 +392,6 @@ static int clamp_thread(void *arg)
unsigned int duration_jiffies = msecs_to_jiffies(duration);
unsigned int window_size_now;
- try_to_freeze();
/*
* make sure user selected ratio does not take effect until
* the next round. adjust target_ratio if user has changed
@@ -740,11 +740,9 @@ static int khvcd(void *unused)
int poll_mask;
struct hvc_struct *hp;
- set_freezable();
do {
poll_mask = 0;
hvc_kicked = 0;
- try_to_freeze();
wmb();
if (!cpus_are_in_xmon()) {
spin_lock(&hvc_structs_lock);
@@ -1930,7 +1930,6 @@ static int uea_kthread(void *data)
struct uea_softc *sc = data;
int ret = -EAGAIN;
- set_freezable();
uea_enters(INS_TO_USBDEV(sc));
while (!kthread_should_stop()) {
if (ret < 0 || sc->reset)
@@ -1939,7 +1938,6 @@ static int uea_kthread(void *data)
ret = sc->stat(sc);
if (ret != -EAGAIN)
uea_wait(sc, 0, msecs_to_jiffies(1000));
- try_to_freeze();
}
uea_leaves(INS_TO_USBDEV(sc));
return ret;
@@ -611,14 +611,12 @@ static bool start_out_transfer(struct fsg_common *common, struct fsg_buffhd *bh)
return true;
}
-static int sleep_thread(struct fsg_common *common, bool can_freeze)
+static int sleep_thread(struct fsg_common *common)
{
int rc = 0;
/* Wait until a signal arrives or we are woken up */
for (;;) {
- if (can_freeze)
- try_to_freeze();
set_current_state(TASK_INTERRUPTIBLE);
if (signal_pending(current)) {
rc = -EINTR;
@@ -692,7 +690,7 @@ static int do_read(struct fsg_common *common)
/* Wait for the next buffer to become available */
bh = common->next_buffhd_to_fill;
while (bh->state != BUF_STATE_EMPTY) {
- rc = sleep_thread(common, false);
+ rc = sleep_thread(common);
if (rc)
return rc;
}
@@ -947,7 +945,7 @@ static int do_write(struct fsg_common *common)
}
/* Wait for something to happen */
- rc = sleep_thread(common, false);
+ rc = sleep_thread(common);
if (rc)
return rc;
}
@@ -1514,7 +1512,7 @@ static int throw_away_data(struct fsg_common *common)
}
/* Otherwise wait for something to happen */
- rc = sleep_thread(common, true);
+ rc = sleep_thread(common);
if (rc)
return rc;
}
@@ -1635,7 +1633,7 @@ static int send_status(struct fsg_common *common)
/* Wait for the next buffer to become available */
bh = common->next_buffhd_to_fill;
while (bh->state != BUF_STATE_EMPTY) {
- rc = sleep_thread(common, true);
+ rc = sleep_thread(common);
if (rc)
return rc;
}
@@ -1838,7 +1836,7 @@ static int do_scsi_command(struct fsg_common *common)
bh = common->next_buffhd_to_fill;
common->next_buffhd_to_drain = bh;
while (bh->state != BUF_STATE_EMPTY) {
- rc = sleep_thread(common, true);
+ rc = sleep_thread(common);
if (rc)
return rc;
}
@@ -2185,7 +2183,7 @@ static int get_next_command(struct fsg_common *common)
/* Wait for the next buffer to become available */
bh = common->next_buffhd_to_fill;
while (bh->state != BUF_STATE_EMPTY) {
- rc = sleep_thread(common, true);
+ rc = sleep_thread(common);
if (rc)
return rc;
}
@@ -2204,7 +2202,7 @@ static int get_next_command(struct fsg_common *common)
/* Wait for the CBW to arrive */
while (bh->state != BUF_STATE_FULL) {
- rc = sleep_thread(common, true);
+ rc = sleep_thread(common);
if (rc)
return rc;
}
@@ -2390,7 +2388,7 @@ static void handle_exception(struct fsg_common *common)
}
if (num_active == 0)
break;
- if (sleep_thread(common, true))
+ if (sleep_thread(common))
return;
}
@@ -2509,9 +2507,6 @@ static int fsg_main_thread(void *common_)
allow_signal(SIGKILL);
allow_signal(SIGUSR1);
- /* Allow the thread to be frozen */
- set_freezable();
-
/*
* Arrange for userspace references to be interpreted as kernel
* pointers. That way we can pass a kernel pointer to a routine
@@ -2527,7 +2522,7 @@ static int fsg_main_thread(void *common_)
}
if (!common->running) {
- sleep_thread(common, true);
+ sleep_thread(common);
continue;
}
@@ -279,7 +279,6 @@ static int uwbd(void *param)
HZ);
if (should_stop)
break;
- try_to_freeze();
spin_lock_irqsave(&rc->uwbd.event_list_lock, flags);
if (!list_empty(&rc->uwbd.event_list)) {
@@ -890,9 +890,7 @@ static int ps3fbd(void *arg)
{
struct fb_info *info = arg;
- set_freezable();
while (!kthread_should_stop()) {
- try_to_freeze();
set_current_state(TASK_INTERRUPTIBLE);
if (ps3fb.is_kicked) {
ps3fb.is_kicked = 0;
@@ -1269,12 +1269,8 @@ static int pxafb_smart_thread(void *arg)
pr_debug("%s(): task starting\n", __func__);
- set_freezable();
while (!kthread_should_stop()) {
- if (try_to_freeze())
- continue;
-
mutex_lock(&fbi->ctrlr_lock);
if (fbi->state == C_ENABLE) {
@@ -350,12 +350,9 @@ static int balloon(void *_vballoon)
struct virtio_balloon *vb = _vballoon;
DEFINE_WAIT_FUNC(wait, woken_wake_function);
- set_freezable();
while (!kthread_should_stop()) {
s64 diff;
- try_to_freeze();
-
add_wait_queue(&vb->config_change, &wait);
for (;;) {
if ((diff = towards_target(vb)) != 0 ||
@@ -1147,7 +1147,6 @@ int w1_process(void *data)
jremain = 1;
}
- try_to_freeze();
__set_current_state(TASK_INTERRUPTIBLE);
/* hold list_mutex until after interruptible to prevent loosing
@@ -1798,7 +1798,7 @@ static int cleaner_kthread(void *arg)
*/
btrfs_delete_unused_bgs(root->fs_info);
sleep:
- if (!try_to_freeze() && !again) {
+ if (!again) {
set_current_state(TASK_INTERRUPTIBLE);
if (!kthread_should_stop())
schedule();
@@ -1888,14 +1888,12 @@ sleep:
if (unlikely(test_bit(BTRFS_FS_STATE_ERROR,
&root->fs_info->fs_state)))
btrfs_cleanup_transaction(root);
- if (!try_to_freeze()) {
- set_current_state(TASK_INTERRUPTIBLE);
- if (!kthread_should_stop() &&
- (!btrfs_transaction_blocked(root->fs_info) ||
- cannot_commit))
- schedule_timeout(delay);
- __set_current_state(TASK_RUNNING);
- }
+ set_current_state(TASK_INTERRUPTIBLE);
+ if (!kthread_should_stop() &&
+ (!btrfs_transaction_blocked(root->fs_info) ||
+ cannot_commit))
+ schedule_timeout(delay);
+ __set_current_state(TASK_RUNNING);
} while (!kthread_should_stop());
return 0;
}
@@ -384,7 +384,6 @@ cifs_reconnect(struct TCP_Server_Info *server)
}
do {
- try_to_freeze();
/* we should try only the port we connected to before */
mutex_lock(&server->srv_mutex);
@@ -563,7 +562,6 @@ cifs_readv_from_socket(struct TCP_Server_Info *server, struct kvec *iov_orig,
smb_msg.msg_controllen = 0;
for (total_read = 0; to_read; total_read += length, to_read -= length) {
- try_to_freeze();
if (server_unresponsive(server)) {
total_read = -ECONNABORTED;
@@ -855,10 +853,7 @@ cifs_demultiplex_thread(void *p)
if (length > 1)
mempool_resize(cifs_req_poolp, length + cifs_min_rcv);
- set_freezable();
while (server->tcpStatus != CifsExiting) {
- if (try_to_freeze())
- continue;
if (!allocate_buffers(server))
continue;
@@ -55,11 +55,10 @@ static struct task_struct *ecryptfs_kthread;
*/
static int ecryptfs_threadfn(void *ignored)
{
- set_freezable();
while (1) {
struct ecryptfs_open_req *req;
- wait_event_freezable(
+ wait_event_interruptible(
ecryptfs_kthread_ctl.wait,
(!list_empty(&ecryptfs_kthread_ctl.req_list)
|| kthread_should_stop()));
@@ -3036,8 +3036,6 @@ cont_thread:
}
mutex_unlock(&eli->li_list_mtx);
- try_to_freeze();
-
cur = jiffies;
if ((time_after_eq(cur, next_wakeup)) ||
(MAX_JIFFY_OFFSET == next_wakeup)) {
@@ -34,12 +34,9 @@ static int gc_thread_func(void *data)
wait_ms = gc_th->min_sleep_time;
do {
- if (try_to_freeze())
- continue;
- else
- wait_event_interruptible_timeout(*wq,
- kthread_should_stop(),
- msecs_to_jiffies(wait_ms));
+ wait_event_interruptible_timeout(*wq,
+ kthread_should_stop(),
+ msecs_to_jiffies(wait_ms));
if (kthread_should_stop())
break;
@@ -930,8 +930,6 @@ int gfs2_logd(void *data)
t = gfs2_tune_get(sdp, gt_logd_secs) * HZ;
- try_to_freeze();
-
do {
prepare_to_wait(&sdp->sd_logd_waitq, &wait,
TASK_INTERRUPTIBLE);
@@ -1520,8 +1520,6 @@ int gfs2_quotad(void *data)
/* Check for & recover partially truncated inodes */
quotad_check_trunc_list(sdp);
- try_to_freeze();
-
t = min(quotad_timeo, statfs_timeo);
prepare_to_wait(&sdp->sd_quota_wait, &wait, TASK_INTERRUPTIBLE);
@@ -198,8 +198,6 @@ static int kjournald2(void *arg)
setup_timer(&journal->j_commit_timer, commit_timeout,
(unsigned long)current);
- set_freezable();
-
/* Record that the journal thread is running */
journal->j_task = current;
wake_up(&journal->j_wait_done_commit);
@@ -234,7 +232,6 @@ loop:
*/
jbd_debug(1, "Now suspending kjournald2\n");
write_unlock(&journal->j_state_lock);
- try_to_freeze();
write_lock(&journal->j_state_lock);
} else {
/*
@@ -88,7 +88,6 @@ static int jffs2_garbage_collect_thread(void *_c)
set_user_nice(current, 10);
- set_freezable();
for (;;) {
sigprocmask(SIG_UNBLOCK, &hupmask, NULL);
again:
@@ -124,9 +123,6 @@ static int jffs2_garbage_collect_thread(void *_c)
siginfo_t info;
unsigned long signr;
- if (try_to_freeze())
- goto again;
-
signr = dequeue_signal_lock(current, ¤t->blocked, &info);
switch(signr) {
@@ -2347,7 +2347,6 @@ int jfsIOWait(void *arg)
if (freezing(current)) {
spin_unlock_irq(&log_redrive_lock);
- try_to_freeze();
} else {
set_current_state(TASK_INTERRUPTIBLE);
spin_unlock_irq(&log_redrive_lock);
@@ -2797,18 +2797,13 @@ int jfs_lazycommit(void *arg)
/* In case a wakeup came while all threads were active */
jfs_commit_thread_waking = 0;
- if (freezing(current)) {
- LAZY_UNLOCK(flags);
- try_to_freeze();
- } else {
- DECLARE_WAITQUEUE(wq, current);
+ DECLARE_WAITQUEUE(wq, current);
- add_wait_queue(&jfs_commit_thread_wait, &wq);
- set_current_state(TASK_INTERRUPTIBLE);
- LAZY_UNLOCK(flags);
- schedule();
- remove_wait_queue(&jfs_commit_thread_wait, &wq);
- }
+ add_wait_queue(&jfs_commit_thread_wait, &wq);
+ set_current_state(TASK_INTERRUPTIBLE);
+ LAZY_UNLOCK(flags);
+ schedule();
+ remove_wait_queue(&jfs_commit_thread_wait, &wq);
} while (!kthread_should_stop());
if (!list_empty(&TxAnchor.unlock_queue))
@@ -2987,14 +2982,9 @@ int jfs_sync(void *arg)
/* Add anon_list2 back to anon_list */
list_splice_init(&TxAnchor.anon_list2, &TxAnchor.anon_list);
- if (freezing(current)) {
- TXN_UNLOCK();
- try_to_freeze();
- } else {
- set_current_state(TASK_INTERRUPTIBLE);
- TXN_UNLOCK();
- schedule();
- }
+ set_current_state(TASK_INTERRUPTIBLE);
+ TXN_UNLOCK();
+ schedule();
} while (!kthread_should_stop());
jfs_info("jfs_sync being killed");
@@ -130,9 +130,6 @@ lockd(void *vrqstp)
int err = 0;
struct svc_rqst *rqstp = vrqstp;
- /* try_to_freeze() is called from svc_recv() */
- set_freezable();
-
/* Allow SIGKILL to tell lockd to drop all of its locks */
allow_signal(SIGKILL);
@@ -75,8 +75,6 @@ nfs4_callback_svc(void *vrqstp)
int err;
struct svc_rqst *rqstp = vrqstp;
- set_freezable();
-
while (!kthread_should_stop()) {
/*
* Listen for a request on the socket
@@ -122,11 +120,7 @@ nfs41_callback_svc(void *vrqstp)
int error;
DEFINE_WAIT(wq);
- set_freezable();
-
while (!kthread_should_stop()) {
- if (try_to_freeze())
- continue;
prepare_to_wait(&serv->sv_cb_waitq, &wq, TASK_INTERRUPTIBLE);
spin_lock_bh(&serv->sv_cb_lock);
@@ -605,8 +605,6 @@ nfsd(void *vrqstp)
nfsdstats.th_cnt++;
mutex_unlock(&nfsd_mutex);
- set_freezable();
-
/*
* The main request loop
*/
@@ -2506,37 +2506,31 @@ static int nilfs_segctor_thread(void *arg)
}
- if (freezing(current)) {
+ DEFINE_WAIT(wait);
+ int should_sleep = 1;
+
+ prepare_to_wait(&sci->sc_wait_daemon, &wait,
+ TASK_INTERRUPTIBLE);
+
+ if (sci->sc_seq_request != sci->sc_seq_done)
+ should_sleep = 0;
+ else if (sci->sc_flush_request)
+ should_sleep = 0;
+ else if (sci->sc_state & NILFS_SEGCTOR_COMMIT)
+ should_sleep = time_before(jiffies,
+ sci->sc_timer.expires);
+
+ if (should_sleep) {
spin_unlock(&sci->sc_state_lock);
- try_to_freeze();
+ schedule();
spin_lock(&sci->sc_state_lock);
- } else {
- DEFINE_WAIT(wait);
- int should_sleep = 1;
-
- prepare_to_wait(&sci->sc_wait_daemon, &wait,
- TASK_INTERRUPTIBLE);
-
- if (sci->sc_seq_request != sci->sc_seq_done)
- should_sleep = 0;
- else if (sci->sc_flush_request)
- should_sleep = 0;
- else if (sci->sc_state & NILFS_SEGCTOR_COMMIT)
- should_sleep = time_before(jiffies,
- sci->sc_timer.expires);
-
- if (should_sleep) {
- spin_unlock(&sci->sc_state_lock);
- schedule();
- spin_lock(&sci->sc_state_lock);
- }
- finish_wait(&sci->sc_wait_daemon, &wait);
- timeout = ((sci->sc_state & NILFS_SEGCTOR_COMMIT) &&
- time_after_eq(jiffies, sci->sc_timer.expires));
-
- if (nilfs_sb_dirty(nilfs) && nilfs_sb_need_update(nilfs))
- set_nilfs_discontinued(nilfs);
}
+ finish_wait(&sci->sc_wait_daemon, &wait);
+ timeout = ((sci->sc_state & NILFS_SEGCTOR_COMMIT) &&
+ time_after_eq(jiffies, sci->sc_timer.expires));
+
+ if (nilfs_sb_dirty(nilfs) && nilfs_sb_need_update(nilfs))
+ set_nilfs_discontinued(nilfs);
goto loop;
end_thread:
@@ -291,15 +291,11 @@ int ubifs_bg_thread(void *info)
ubifs_msg(c, "background thread \"%s\" started, PID %d",
c->bgt_name, current->pid);
- set_freezable();
while (1) {
if (kthread_should_stop())
break;
- if (try_to_freeze())
- continue;
-
set_current_state(TASK_INTERRUPTIBLE);
/* Check if there is something to do */
if (!c->need_bgt) {
@@ -530,8 +530,6 @@ xfsaild(
__set_current_state(TASK_RUNNING);
- try_to_freeze();
-
tout = xfsaild_push(ailp);
}
@@ -498,7 +498,6 @@ static void flush_hold_queue(void)
static int kauditd_thread(void *dummy)
{
- set_freezable();
while (!kthread_should_stop()) {
struct sk_buff *skb;
@@ -516,7 +515,7 @@ static int kauditd_thread(void *dummy)
continue;
}
- wait_event_freezable(kauditd_wait, skb_queue_len(&audit_skb_queue));
+ wait_event(kauditd_wait, skb_queue_len(&audit_skb_queue));
}
return 0;
}
@@ -596,7 +596,6 @@ repeat:
} else if (!freezing(current))
schedule();
- try_to_freeze();
goto repeat;
}
EXPORT_SYMBOL_GPL(kthread_worker_fn);
@@ -2877,7 +2877,7 @@ static void khugepaged_do_scan(void)
cond_resched();
- if (unlikely(kthread_should_stop() || try_to_freeze()))
+ if (unlikely(kthread_should_stop()))
break;
spin_lock(&khugepaged_mm_lock);
@@ -2902,21 +2902,20 @@ static void khugepaged_wait_work(void)
if (!khugepaged_scan_sleep_millisecs)
return;
- wait_event_freezable_timeout(khugepaged_wait,
+ wait_event_interruptible_timeout(khugepaged_wait,
kthread_should_stop(),
msecs_to_jiffies(khugepaged_scan_sleep_millisecs));
return;
}
if (khugepaged_enabled())
- wait_event_freezable(khugepaged_wait, khugepaged_wait_event());
+ wait_event_interruptible(khugepaged_wait, khugepaged_wait_event());
}
static int khugepaged(void *none)
{
struct mm_slot *mm_slot;
- set_freezable();
set_user_nice(current, MAX_NICE);
while (!kthread_should_stop()) {
@@ -1712,7 +1712,6 @@ static int ksmd_should_run(void)
static int ksm_scan_thread(void *nothing)
{
- set_freezable();
set_user_nice(current, 5);
while (!kthread_should_stop()) {
@@ -1722,13 +1721,11 @@ static int ksm_scan_thread(void *nothing)
ksm_do_scan(ksm_thread_pages_to_scan);
mutex_unlock(&ksm_thread_mutex);
- try_to_freeze();
-
if (ksmd_should_run()) {
schedule_timeout_interruptible(
msecs_to_jiffies(ksm_thread_sleep_millisecs));
} else {
- wait_event_freezable(ksm_thread_wait,
+ wait_event_interruptible(ksm_thread_wait,
ksmd_should_run() || kthread_should_stop());
}
}
@@ -3314,7 +3314,7 @@ static unsigned long balance_pgdat(pg_data_t *pgdat, int order,
order = sc.order = 0;
/* Check if kswapd should be suspending */
- if (try_to_freeze() || kthread_should_stop())
+ if (kthread_should_stop())
break;
/*
@@ -3445,7 +3445,6 @@ static int kswapd(void *p)
* trying to free the first piece of memory in the first place).
*/
tsk->flags |= PF_MEMALLOC | PF_SWAPWRITE | PF_KSWAPD;
- set_freezable();
order = new_order = 0;
balanced_order = 0;
@@ -3485,7 +3484,6 @@ static int kswapd(void *p)
pgdat->classzone_idx = pgdat->nr_zones - 1;
}
- ret = try_to_freeze();
if (kthread_should_stop())
break;
@@ -3493,12 +3491,10 @@ static int kswapd(void *p)
* We can speed up thawing tasks if we don't call balance_pgdat
* after returning from the refrigerator
*/
- if (!ret) {
- trace_mm_vmscan_kswapd_wake(pgdat->node_id, order);
- balanced_classzone_idx = classzone_idx;
- balanced_order = balance_pgdat(pgdat, order,
- &balanced_classzone_idx);
- }
+ trace_mm_vmscan_kswapd_wake(pgdat->node_id, order);
+ balanced_classzone_idx = classzone_idx;
+ balanced_order = balance_pgdat(pgdat, order,
+ &balanced_classzone_idx);
}
tsk->flags &= ~(PF_MEMALLOC | PF_SWAPWRITE | PF_KSWAPD);
@@ -3511,8 +3511,6 @@ static int pktgen_thread_worker(void *arg)
pr_debug("starting pktgen/%d: pid=%d\n", cpu, task_pid_nr(current));
- set_freezable();
-
while (!kthread_should_stop()) {
pkt_dev = next_to_run(t);
@@ -3522,7 +3520,6 @@ static int pktgen_thread_worker(void *arg)
wait_event_interruptible_timeout(t->queue,
t->control != 0,
HZ/10);
- try_to_freeze();
continue;
}
@@ -3554,8 +3551,6 @@ static int pktgen_thread_worker(void *arg)
pktgen_rem_one_if(t);
t->control &= ~(T_REMDEV);
}
-
- try_to_freeze();
}
pr_debug("%s stopping all device\n", t->tsk->comm);
@@ -806,7 +806,6 @@ int svc_recv(struct svc_rqst *rqstp, long timeout)
if (err)
goto out;
- try_to_freeze();
cond_resched();
err = -EINTR;
if (signalled() || kthread_should_stop())