sched/fair: updates weight of cfs_rq before update_cfs_group() in enqueue_entity()
PATCH 1/1 sched/fair: updates weight of cfs_rq before update_cfs_group() in enqueue_entity()
we should update the weight of cfs_rq before update_cfs_group(). Ensure that we can get accurate shares of the cfs_rq when its weights changes. we can find this work was done correctly in dequeue_entity(). so fix it.
--- kernel/sched/fair.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
kernel/sched/fair.c +6 -2
@@ -5304,6 +5304,12 @@ enqueue_entity(struct cfs_rq *cfs_rq, struct sched_entity *se, int flags)*/ update_load_avg (cfs_rq, se,UPDATE_TG |DO_ATTACH );se_update_runnable (se); + +/* +* we should update the weight of cfs_rq before update_cfs_group. +* Ensure we can get accurate shares of the cfs_rq when its weights changes. +*/ +account_entity_enqueue (cfs_rq, se);/* * XXX update_load_avg() above will have attached us to the pelt sum; * but update_cfs_group() here will re-adjust the weight and have to
@@ -5318,8 +5324,6 @@ enqueue_entity(struct cfs_rq *cfs_rq, struct sched_entity *se, int flags)if (!curr)place_entity (cfs_rq, se, flags); -account_entity_enqueue (cfs_rq, se); -/* Entity has migrated, no longer consider this task hot */ if (flags &ENQUEUE_MIGRATED ) se->exec_start =0 ;
Signature · 1 line
2.17.1
kernel test robot
build botkernel test robot noticed "WARNING:at_kernel/sched/fair.c:#place_entity" on:
Hello,
kernel test robot noticed "WARNING:at_kernel/sched/fair.c:#place_entity" on:
commit: 06d0c29c533e77cef4f1793343c78180b32645e0 ("[PATCH] sched/fair: updates weight of cfs_rq before update_cfs_group() in enqueue_entity()")
url: https://github.com/intel-lab-lkp/linux/commits/pugaowei/sched-fair-updates-weight-of-cfs_rq-before-update_cfs_group-in-enqueue_entity/20240531-111010
base: https://git.kernel.org/cgit/linux/kernel/git/tip/tip.git 402de7fc880fef055bc984957454b532987e9ad0
patch link: https://lore.kernel.org/all/[email protected]/
patch subject: [PATCH] sched/fair: updates weight of cfs_rq before update_cfs_group() in enqueue_entity()
in testcase: boot
compiler: gcc-13
test machine: qemu-system-x86_64 -enable-kvm -cpu SandyBridge -smp 2 -m 16G
(please refer to attached dmesg/kmsg for entire log/backtrace)
+----------------------------------------------+------------+------------+ | | 402de7fc88 | 06d0c29c53 | +----------------------------------------------+------------+------------+ | WARNING:at_kernel/sched/fair.c:#place_entity | 0 | 8 | | RIP:place_entity | 0 | 8 | +----------------------------------------------+------------+------------+
If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-lkp/[email protected]
[ 0.400409][ T0] ------------[ cut here ]------------ [ 0.400603][ T0] WARNING: CPU: 0 PID: 0 at kernel/sched/fair.c:5256 place_entity (kernel/sched/fair.c:5256 (discriminator 1)) [ 0.400603][ T0] Modules linked in: [ 0.400603][ T0] CPU: 0 PID: 0 Comm: swapper/0 Not tainted 6.10.0-rc1-00003-g06d0c29c533e #1 [ 0.400603][ T0] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.16.2-debian-1.16.2-1 04/01/2014 [ 0.400603][ T0] RIP: 0010:place_entity (kernel/sched/fair.c:5256 (discriminator 1)) [ 0.400603][ T0] Code: 29 c5 eb 82 b9 02 00 00 00 49 c1 ee 0a 49 39 ce 4c 0f 42 f1 49 8d 0c 16 eb d4 48 89 de e8 a0 5c ff ff 48 89 c7 e9 50 ff ff ff <0f> 0b eb d1 0f 1f 40 00 90 90 90 90 90 90 90 90 90 90 90 90 90 90 All code ======== 0: 29 c5 sub %eax,%ebp 2: eb 82 jmp 0xffffffffffffff86 4: b9 02 00 00 00 mov $0x2,%ecx 9: 49 c1 ee 0a shr $0xa,%r14 d: 49 39 ce cmp %rcx,%r14 10: 4c 0f 42 f1 cmovb %rcx,%r14 14: 49 8d 0c 16 lea (%r14,%rdx,1),%rcx 18: eb d4 jmp 0xffffffffffffffee 1a: 48 89 de mov %rbx,%rsi 1d: e8 a0 5c ff ff callq 0xffffffffffff5cc2 22: 48 89 c7 mov %rax,%rdi 25: e9 50 ff ff ff jmpq 0xffffffffffffff7a 2a:* 0f 0b ud2 <-- trapping instruction 2c: eb d1 jmp 0xffffffffffffffff 2e: 0f 1f 40 00 nopl 0x0(%rax) 32: 90 nop 33: 90 nop 34: 90 nop 35: 90 nop 36: 90 nop 37: 90 nop 38: 90 nop 39: 90 nop 3a: 90 nop 3b: 90 nop 3c: 90 nop 3d: 90 nop 3e: 90 nop 3f: 90 nop
Code starting with the faulting instruction
===========================================
0: 0f 0b ud2 2: eb d1 jmp 0xffffffffffffffd5 4: 0f 1f 40 00 nopl 0x0(%rax) 8: 90 nop 9: 90 nop a: 90 nop b: 90 nop c: 90 nop d: 90 nop e: 90 nop f: 90 nop 10: 90 nop 11: 90 nop 12: 90 nop 13: 90 nop 14: 90 nop 15: 90 nop [ 0.400603][ T0] RSP: 0000:ffffffff8f403d38 EFLAGS: 00010046 [ 0.400603][ T0] RAX: 0000000000000000 RBX: ffff9a3e4026a880 RCX: 0000000000000400 [ 0.400603][ T0] RDX: 0000000000000000 RSI: fffffffffff00000 RDI: 00000000000b71b0 [ 0.400603][ T0] RBP: fffffffffff00000 R08: 0000000000000001 R09: 0000000000000000 [ 0.400603][ T0] R10: 0000000000000000 R11: 0000000094f4efa8 R12: ffff9a416fc348c0 [ 0.400603][ T0] R13: 0000000000000008 R14: 0000000000000400 R15: 0000000000000001 [ 0.400603][ T0] FS: 0000000000000000(0000) GS:ffff9a416fc00000(0000) knlGS:0000000000000000 [ 0.400603][ T0] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [ 0.400603][ T0] CR2: ffff9a417ffff000 CR3: 00000001e4a1c000 CR4: 00000000000406f0 [ 0.400603][ T0] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 [ 0.400603][ T0] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 [ 0.400603][ T0] Call Trace: [ 0.400603][ T0] <TASK> [ 0.400603][ T0] ? __warn (kernel/panic.c:693) [ 0.400603][ T0] ? place_entity (kernel/sched/fair.c:5256 (discriminator 1)) [ 0.400603][ T0] ? report_bug (lib/bug.c:180 lib/bug.c:219) [ 0.400603][ T0] ? handle_bug (arch/x86/kernel/traps.c:239) [ 0.400603][ T0] ? exc_invalid_op (arch/x86/kernel/traps.c:260 (discriminator 1)) [ 0.400603][ T0] ? asm_exc_invalid_op (arch/x86/include/asm/idtentry.h:621) [ 0.400603][ T0] ? place_entity (kernel/sched/fair.c:5256 (discriminator 1)) [ 0.400603][ T0] ? place_entity (kernel/sched/fair.c:5182) [ 0.400603][ T0] enqueue_entity (kernel/sched/fair.c:5328) [ 0.400603][ T0] enqueue_task_fair (kernel/sched/fair.c:6785) [ 0.400603][ T0] wake_up_new_task (kernel/sched/core.c:2015 (discriminator 2) kernel/sched/core.c:4693 (discriminator 2)) [ 0.400603][ T0] kernel_clone (kernel/fork.c:2831 (discriminator 1)) [ 0.400603][ T0] user_mode_thread (kernel/fork.c:2876) [ 0.400603][ T0] ? __pfx_kernel_init (init/main.c:1459) [ 0.400603][ T0] rest_init (init/main.c:712) [ 0.400603][ T0] start_kernel (include/trace/events/initcall.h:27 init/main.c:1234 init/main.c:1001) [ 0.400603][ T0] x86_64_start_reservations (arch/x86/kernel/head64.c:495) [ 0.400603][ T0] x86_64_start_kernel (arch/x86/kernel/head64.c:437 (discriminator 5)) [ 0.400603][ T0] common_startup_64 (arch/x86/kernel/head_64.S:421) [ 0.400603][ T0] </TASK> [ 0.400603][ T0] ---[ end trace 0000000000000000 ]---
The kernel config and materials to reproduce are available at:
https://download.01.org/0day-ci/archive/20240603/[email protected]
Signature · 2 lines
0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki
I have submitted a V2 to fix this warning yesterday:
https://lore.kernel.org/linux-kernel/[email protected]/T/
tks.
-----邮件原件-----
发件人: kernel test robot <[email protected]>
发送时间: 2024年6月3日 13:51
收件人: 普高伟(kuroky) <[email protected]>
抄送: [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; 普高伟(kuroky) <[email protected]>; [email protected] 主题: Re: [PATCH] sched/fair: updates weight of cfs_rq before update_cfs_group() in enqueue_entity()
Hello,
kernel test robot noticed "WARNING:at_kernel/sched/fair.c:#place_entity" on:
commit: 06d0c29c533e77cef4f1793343c78180b32645e0 ("[PATCH] sched/fair: updates weight of cfs_rq before update_cfs_group() in enqueue_entity()")
url: https://github.com/intel-lab-lkp/linux/commits/pugaowei/sched-fair-updates-weight-of-cfs_rq-before-update_cfs_group-in-enqueue_entity/20240531-111010
base: https://git.kernel.org/cgit/linux/kernel/git/tip/tip.git 402de7fc880fef055bc984957454b532987e9ad0
patch link: https://lore.kernel.org/all/[email protected]/
patch subject: [PATCH] sched/fair: updates weight of cfs_rq before update_cfs_group() in enqueue_entity()
in testcase: boot
compiler: gcc-13
test machine: qemu-system-x86_64 -enable-kvm -cpu SandyBridge -smp 2 -m 16G
(please refer to attached dmesg/kmsg for entire log/backtrace)
+----------------------------------------------+------------+------------+ | | 402de7fc88 | 06d0c29c53 | | +----------------------------------------------+------------+------------+ | WARNING:at_kernel/sched/fair.c:#place_entity | 0 | 8 | | RIP:place_entity | 0 | 8 | +----------------------------------------------+------------+------------+
If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]> | Closes: | https://lore.kernel.org/oe-lkp/202406031240.f2476e94-oliver.sang@intel | .com
[ 0.400409][ T0] ------------[ cut here ]------------ [ 0.400603][ T0] WARNING: CPU: 0 PID: 0 at kernel/sched/fair.c:5256 place_entity (kernel/sched/fair.c:5256 (discriminator 1)) [ 0.400603][ T0] Modules linked in: [ 0.400603][ T0] CPU: 0 PID: 0 Comm: swapper/0 Not tainted 6.10.0-rc1-00003-g06d0c29c533e #1 [ 0.400603][ T0] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.16.2-debian-1.16.2-1 04/01/2014 [ 0.400603][ T0] RIP: 0010:place_entity (kernel/sched/fair.c:5256 (discriminator 1)) [ 0.400603][ T0] Code: 29 c5 eb 82 b9 02 00 00 00 49 c1 ee 0a 49 39 ce 4c 0f 42 f1 49 8d 0c 16 eb d4 48 89 de e8 a0 5c ff ff 48 89 c7 e9 50 ff ff ff <0f> 0b eb d1 0f 1f 40 00 90 90 90 90 90 90 90 90 90 90 90 90 90 90 All code ======== 0: 29 c5 sub %eax,%ebp 2: eb 82 jmp 0xffffffffffffff86 4: b9 02 00 00 00 mov $0x2,%ecx 9: 49 c1 ee 0a shr $0xa,%r14 d: 49 39 ce cmp %rcx,%r14 10: 4c 0f 42 f1 cmovb %rcx,%r14 14: 49 8d 0c 16 lea (%r14,%rdx,1),%rcx 18: eb d4 jmp 0xffffffffffffffee 1a: 48 89 de mov %rbx,%rsi 1d: e8 a0 5c ff ff callq 0xffffffffffff5cc2 22: 48 89 c7 mov %rax,%rdi 25: e9 50 ff ff ff jmpq 0xffffffffffffff7a 2a:* 0f 0b ud2 <-- trapping instruction 2c: eb d1 jmp 0xffffffffffffffff 2e: 0f 1f 40 00 nopl 0x0(%rax) 32: 90 nop 33: 90 nop 34: 90 nop 35: 90 nop 36: 90 nop 37: 90 nop 38: 90 nop 39: 90 nop 3a: 90 nop 3b: 90 nop 3c: 90 nop 3d: 90 nop 3e: 90 nop 3f: 90 nop
Code starting with the faulting instruction ===========================================
0: 0f 0b ud2 2: eb d1 jmp 0xffffffffffffffd5 4: 0f 1f 40 00 nopl 0x0(%rax) 8: 90 nop 9: 90 nop a: 90 nop b: 90 nop c: 90 nop d: 90 nop e: 90 nop f: 90 nop 10: 90 nop 11: 90 nop 12: 90 nop 13: 90 nop 14: 90 nop 15: 90 nop [ 0.400603][ T0] RSP: 0000:ffffffff8f403d38 EFLAGS: 00010046 [ 0.400603][ T0] RAX: 0000000000000000 RBX: ffff9a3e4026a880 RCX: 0000000000000400 [ 0.400603][ T0] RDX: 0000000000000000 RSI: fffffffffff00000 RDI: 00000000000b71b0 [ 0.400603][ T0] RBP: fffffffffff00000 R08: 0000000000000001 R09: 0000000000000000 [ 0.400603][ T0] R10: 0000000000000000 R11: 0000000094f4efa8 R12: ffff9a416fc348c0 [ 0.400603][ T0] R13: 0000000000000008 R14: 0000000000000400 R15: 0000000000000001 [ 0.400603][ T0] FS: 0000000000000000(0000) GS:ffff9a416fc00000(0000) knlGS:0000000000000000 [ 0.400603][ T0] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [ 0.400603][ T0] CR2: ffff9a417ffff000 CR3: 00000001e4a1c000 CR4: 00000000000406f0 [ 0.400603][ T0] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 [ 0.400603][ T0] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 [ 0.400603][ T0] Call Trace: [ 0.400603][ T0] <TASK> [ 0.400603][ T0] ? __warn (kernel/panic.c:693) [ 0.400603][ T0] ? place_entity (kernel/sched/fair.c:5256 (discriminator 1)) [ 0.400603][ T0] ? report_bug (lib/bug.c:180 lib/bug.c:219) [ 0.400603][ T0] ? handle_bug (arch/x86/kernel/traps.c:239) [ 0.400603][ T0] ? exc_invalid_op (arch/x86/kernel/traps.c:260 (discriminator 1)) [ 0.400603][ T0] ? asm_exc_invalid_op (arch/x86/include/asm/idtentry.h:621) [ 0.400603][ T0] ? place_entity (kernel/sched/fair.c:5256 (discriminator 1)) [ 0.400603][ T0] ? place_entity (kernel/sched/fair.c:5182) [ 0.400603][ T0] enqueue_entity (kernel/sched/fair.c:5328) [ 0.400603][ T0] enqueue_task_fair (kernel/sched/fair.c:6785) [ 0.400603][ T0] wake_up_new_task (kernel/sched/core.c:2015 (discriminator 2) kernel/sched/core.c:4693 (discriminator 2)) [ 0.400603][ T0] kernel_clone (kernel/fork.c:2831 (discriminator 1)) [ 0.400603][ T0] user_mode_thread (kernel/fork.c:2876) [ 0.400603][ T0] ? __pfx_kernel_init (init/main.c:1459) [ 0.400603][ T0] rest_init (init/main.c:712) [ 0.400603][ T0] start_kernel (include/trace/events/initcall.h:27 init/main.c:1234 init/main.c:1001) [ 0.400603][ T0] x86_64_start_reservations (arch/x86/kernel/head64.c:495) [ 0.400603][ T0] x86_64_start_kernel (arch/x86/kernel/head64.c:437 (discriminator 5)) [ 0.400603][ T0] common_startup_64 (arch/x86/kernel/head_64.S:421) [ 0.400603][ T0] </TASK> [ 0.400603][ T0] ---[ end trace 0000000000000000 ]---
The kernel config and materials to reproduce are available at:
https://download.01.org/0day-ci/archive/20240603/[email protected]
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki