Skip to content

Commit 30c9999

Browse files
committed
Merge tag 'sched-core-2022-10-07' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
Pull scheduler updates from Ingo Molnar: "Debuggability: - Change most occurances of BUG_ON() to WARN_ON_ONCE() - Reorganize & fix TASK_ state comparisons, turn it into a bitmap - Update/fix misc scheduler debugging facilities Load-balancing & regular scheduling: - Improve the behavior of the scheduler in presence of lot of SCHED_IDLE tasks - in particular they should not impact other scheduling classes. - Optimize task load tracking, cleanups & fixes - Clean up & simplify misc load-balancing code Freezer: - Rewrite the core freezer to behave better wrt thawing and be simpler in general, by replacing PF_FROZEN with TASK_FROZEN & fixing/adjusting all the fallout. Deadline scheduler: - Fix the DL capacity-aware code - Factor out dl_task_is_earliest_deadline() & replenish_dl_new_period() - Relax/optimize locking in task_non_contending() Cleanups: - Factor out the update_current_exec_runtime() helper - Various cleanups, simplifications" * tag 'sched-core-2022-10-07' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: (41 commits) sched: Fix more TASK_state comparisons sched: Fix TASK_state comparisons sched/fair: Move call to list_last_entry() in detach_tasks sched/fair: Cleanup loop_max and loop_break sched/fair: Make sure to try to detach at least one movable task sched: Show PF_flag holes freezer,sched: Rewrite core freezer logic sched: Widen TAKS_state literals sched/wait: Add wait_event_state() sched/completion: Add wait_for_completion_state() sched: Add TASK_ANY for wait_task_inactive() sched: Change wait_task_inactive()s match_state freezer,umh: Clean up freezer/initrd interaction freezer: Have {,un}lock_system_sleep() save/restore flags sched: Rename task_running() to task_on_cpu() sched/fair: Cleanup for SIS_PROP sched/fair: Default to false in test_idle_cores() sched/fair: Remove useless check in select_idle_core() sched/fair: Avoid double search on same cpu sched/fair: Remove redundant check in select_idle_smt() ...
2 parents 493ffd6 + fdf756f commit 30c9999

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

52 files changed

+616
-760
lines changed

drivers/acpi/x86/s2idle.c

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -654,25 +654,29 @@ void __init acpi_s2idle_setup(void)
654654

655655
int acpi_register_lps0_dev(struct acpi_s2idle_dev_ops *arg)
656656
{
657+
unsigned int sleep_flags;
658+
657659
if (!lps0_device_handle || sleep_no_lps0)
658660
return -ENODEV;
659661

660-
lock_system_sleep();
662+
sleep_flags = lock_system_sleep();
661663
list_add(&arg->list_node, &lps0_s2idle_devops_head);
662-
unlock_system_sleep();
664+
unlock_system_sleep(sleep_flags);
663665

664666
return 0;
665667
}
666668
EXPORT_SYMBOL_GPL(acpi_register_lps0_dev);
667669

668670
void acpi_unregister_lps0_dev(struct acpi_s2idle_dev_ops *arg)
669671
{
672+
unsigned int sleep_flags;
673+
670674
if (!lps0_device_handle || sleep_no_lps0)
671675
return;
672676

673-
lock_system_sleep();
677+
sleep_flags = lock_system_sleep();
674678
list_del(&arg->list_node);
675-
unlock_system_sleep();
679+
unlock_system_sleep(sleep_flags);
676680
}
677681
EXPORT_SYMBOL_GPL(acpi_unregister_lps0_dev);
678682

drivers/android/binder.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4259,10 +4259,9 @@ static int binder_wait_for_work(struct binder_thread *thread,
42594259
struct binder_proc *proc = thread->proc;
42604260
int ret = 0;
42614261

4262-
freezer_do_not_count();
42634262
binder_inner_proc_lock(proc);
42644263
for (;;) {
4265-
prepare_to_wait(&thread->wait, &wait, TASK_INTERRUPTIBLE);
4264+
prepare_to_wait(&thread->wait, &wait, TASK_INTERRUPTIBLE|TASK_FREEZABLE);
42664265
if (binder_has_work_ilocked(thread, do_proc_work))
42674266
break;
42684267
if (do_proc_work)
@@ -4279,7 +4278,6 @@ static int binder_wait_for_work(struct binder_thread *thread,
42794278
}
42804279
finish_wait(&thread->wait, &wait);
42814280
binder_inner_proc_unlock(proc);
4282-
freezer_count();
42834281

42844282
return ret;
42854283
}

drivers/media/pci/pt3/pt3.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -445,8 +445,8 @@ static int pt3_fetch_thread(void *data)
445445
pt3_proc_dma(adap);
446446

447447
delay = ktime_set(0, PT3_FETCH_DELAY * NSEC_PER_MSEC);
448-
set_current_state(TASK_UNINTERRUPTIBLE);
449-
freezable_schedule_hrtimeout_range(&delay,
448+
set_current_state(TASK_UNINTERRUPTIBLE|TASK_FREEZABLE);
449+
schedule_hrtimeout_range(&delay,
450450
PT3_FETCH_DELAY_DELTA * NSEC_PER_MSEC,
451451
HRTIMER_MODE_REL);
452452
}

drivers/powercap/idle_inject.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,7 @@ void idle_inject_stop(struct idle_inject_device *ii_dev)
254254
iit = per_cpu_ptr(&idle_inject_thread, cpu);
255255
iit->should_run = 0;
256256

257-
wait_task_inactive(iit->tsk, 0);
257+
wait_task_inactive(iit->tsk, TASK_ANY);
258258
}
259259

260260
cpu_hotplug_enable();

drivers/scsi/scsi_transport_spi.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -998,16 +998,17 @@ void
998998
spi_dv_device(struct scsi_device *sdev)
999999
{
10001000
struct scsi_target *starget = sdev->sdev_target;
1001-
u8 *buffer;
10021001
const int len = SPI_MAX_ECHO_BUFFER_SIZE*2;
1002+
unsigned int sleep_flags;
1003+
u8 *buffer;
10031004

10041005
/*
10051006
* Because this function and the power management code both call
10061007
* scsi_device_quiesce(), it is not safe to perform domain validation
10071008
* while suspend or resume is in progress. Hence the
10081009
* lock/unlock_system_sleep() calls.
10091010
*/
1010-
lock_system_sleep();
1011+
sleep_flags = lock_system_sleep();
10111012

10121013
if (scsi_autopm_get_device(sdev))
10131014
goto unlock_system_sleep;
@@ -1058,7 +1059,7 @@ spi_dv_device(struct scsi_device *sdev)
10581059
scsi_autopm_put_device(sdev);
10591060

10601061
unlock_system_sleep:
1061-
unlock_system_sleep();
1062+
unlock_system_sleep(sleep_flags);
10621063
}
10631064
EXPORT_SYMBOL(spi_dv_device);
10641065

fs/cifs/inode.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2327,7 +2327,7 @@ cifs_invalidate_mapping(struct inode *inode)
23272327
static int
23282328
cifs_wait_bit_killable(struct wait_bit_key *key, int mode)
23292329
{
2330-
freezable_schedule_unsafe();
2330+
schedule();
23312331
if (signal_pending_state(mode, current))
23322332
return -ERESTARTSYS;
23332333
return 0;
@@ -2345,7 +2345,7 @@ cifs_revalidate_mapping(struct inode *inode)
23452345
return 0;
23462346

23472347
rc = wait_on_bit_lock_action(flags, CIFS_INO_LOCK, cifs_wait_bit_killable,
2348-
TASK_KILLABLE);
2348+
TASK_KILLABLE|TASK_FREEZABLE_UNSAFE);
23492349
if (rc)
23502350
return rc;
23512351

fs/cifs/transport.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -753,8 +753,9 @@ wait_for_response(struct TCP_Server_Info *server, struct mid_q_entry *midQ)
753753
{
754754
int error;
755755

756-
error = wait_event_freezekillable_unsafe(server->response_q,
757-
midQ->mid_state != MID_REQUEST_SUBMITTED);
756+
error = wait_event_state(server->response_q,
757+
midQ->mid_state != MID_REQUEST_SUBMITTED,
758+
(TASK_KILLABLE|TASK_FREEZABLE_UNSAFE));
758759
if (error < 0)
759760
return -ERESTARTSYS;
760761

fs/coredump.c

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -402,17 +402,16 @@ static int coredump_wait(int exit_code, struct core_state *core_state)
402402
if (core_waiters > 0) {
403403
struct core_thread *ptr;
404404

405-
freezer_do_not_count();
406-
wait_for_completion(&core_state->startup);
407-
freezer_count();
405+
wait_for_completion_state(&core_state->startup,
406+
TASK_UNINTERRUPTIBLE|TASK_FREEZABLE);
408407
/*
409408
* Wait for all the threads to become inactive, so that
410409
* all the thread context (extended register state, like
411410
* fpu etc) gets copied to the memory.
412411
*/
413412
ptr = core_state->dumper.next;
414413
while (ptr != NULL) {
415-
wait_task_inactive(ptr->task, 0);
414+
wait_task_inactive(ptr->task, TASK_ANY);
416415
ptr = ptr->next;
417416
}
418417
}

fs/nfs/file.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -567,7 +567,8 @@ static vm_fault_t nfs_vm_page_mkwrite(struct vm_fault *vmf)
567567
}
568568

569569
wait_on_bit_action(&NFS_I(inode)->flags, NFS_INO_INVALIDATING,
570-
nfs_wait_bit_killable, TASK_KILLABLE);
570+
nfs_wait_bit_killable,
571+
TASK_KILLABLE|TASK_FREEZABLE_UNSAFE);
571572

572573
lock_page(page);
573574
mapping = page_file_mapping(page);

fs/nfs/inode.c

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -72,18 +72,13 @@ nfs_fattr_to_ino_t(struct nfs_fattr *fattr)
7272
return nfs_fileid_to_ino_t(fattr->fileid);
7373
}
7474

75-
static int nfs_wait_killable(int mode)
75+
int nfs_wait_bit_killable(struct wait_bit_key *key, int mode)
7676
{
77-
freezable_schedule_unsafe();
77+
schedule();
7878
if (signal_pending_state(mode, current))
7979
return -ERESTARTSYS;
8080
return 0;
8181
}
82-
83-
int nfs_wait_bit_killable(struct wait_bit_key *key, int mode)
84-
{
85-
return nfs_wait_killable(mode);
86-
}
8782
EXPORT_SYMBOL_GPL(nfs_wait_bit_killable);
8883

8984
/**
@@ -1332,7 +1327,8 @@ int nfs_clear_invalid_mapping(struct address_space *mapping)
13321327
*/
13331328
for (;;) {
13341329
ret = wait_on_bit_action(bitlock, NFS_INO_INVALIDATING,
1335-
nfs_wait_bit_killable, TASK_KILLABLE);
1330+
nfs_wait_bit_killable,
1331+
TASK_KILLABLE|TASK_FREEZABLE_UNSAFE);
13361332
if (ret)
13371333
goto out;
13381334
spin_lock(&inode->i_lock);

0 commit comments

Comments
 (0)