* [PATCH] sched/fair: optimize entity_tick()
@ 2022-07-18 9:49 Peng Zhang
2022-07-18 10:10 ` Peter Zijlstra
2022-07-18 18:53 ` kernel test robot
0 siblings, 2 replies; 3+ messages in thread
From: Peng Zhang @ 2022-07-18 9:49 UTC (permalink / raw)
To: mingo, peterz, vincent.guittot, dietmar.eggemann, bsegall, linux-kernel
Cc: zhangpeng.00
From: "zhangpeng.00" <zhangpeng.00@bytedance.com>
entity_tick() will be called to check preemption by calculating each
sched_entity's time_slice in a task group tree from bottom to top.
If a need_resched_flag is set by a checking of a sched_entity,
there is no necessary to check preemption of the sched_entity's
parent and ancestor entity.
So we can test if the need_resched_flag has been set before calling
check_preempt_tick() to avoid unnecessary calculations.
Signed-off-by: zhangpeng.00 <zhangpeng.00@bytedance.com>
---
kernel/sched/fair.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index a78d2e3b9d49..ee23afe22ac7 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -4757,7 +4757,7 @@ entity_tick(struct cfs_rq *cfs_rq, struct sched_entity *curr, int queued)
return;
#endif
- if (cfs_rq->nr_running > 1)
+ if (cfs_rq->nr_running > 1 && !test_tsk_need_resched(rq_of(cfs_rq)->curr))
check_preempt_tick(cfs_rq, curr);
}
--
2.20.1
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] sched/fair: optimize entity_tick()
2022-07-18 9:49 [PATCH] sched/fair: optimize entity_tick() Peng Zhang
@ 2022-07-18 10:10 ` Peter Zijlstra
2022-07-18 18:53 ` kernel test robot
1 sibling, 0 replies; 3+ messages in thread
From: Peter Zijlstra @ 2022-07-18 10:10 UTC (permalink / raw)
To: Peng Zhang
Cc: mingo, vincent.guittot, dietmar.eggemann, bsegall, linux-kernel
On Mon, Jul 18, 2022 at 05:49:37PM +0800, Peng Zhang wrote:
> From: "zhangpeng.00" <zhangpeng.00@bytedance.com>
>
> entity_tick() will be called to check preemption by calculating each
> sched_entity's time_slice in a task group tree from bottom to top.
>
> If a need_resched_flag is set by a checking of a sched_entity,
> there is no necessary to check preemption of the sched_entity's
> parent and ancestor entity.
>
> So we can test if the need_resched_flag has been set before calling
> check_preempt_tick() to avoid unnecessary calculations.
>
> Signed-off-by: zhangpeng.00 <zhangpeng.00@bytedance.com>
Optimization patches should come with numbers showing they're worth it.
Also; did you consider side-effects from check_preempt_tick(), like
clearing buddy state etc.. ?
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] sched/fair: optimize entity_tick()
2022-07-18 9:49 [PATCH] sched/fair: optimize entity_tick() Peng Zhang
2022-07-18 10:10 ` Peter Zijlstra
@ 2022-07-18 18:53 ` kernel test robot
1 sibling, 0 replies; 3+ messages in thread
From: kernel test robot @ 2022-07-18 18:53 UTC (permalink / raw)
To: Peng Zhang, mingo, peterz, vincent.guittot, dietmar.eggemann,
bsegall, linux-kernel
Cc: kbuild-all, zhangpeng.00
Hi Peng,
Thank you for the patch! Perhaps something to improve:
[auto build test WARNING on tip/sched/core]
[also build test WARNING on linus/master v5.19-rc7 next-20220718]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Peng-Zhang/sched-fair-optimize-entity_tick/20220718-175245
base: https://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git 401e4963bf45c800e3e9ea0d3a0289d738005fd4
config: nios2-randconfig-s042-20220718 (https://download.01.org/0day-ci/archive/20220719/202207190234.1dmTZy65-lkp@intel.com/config)
compiler: nios2-linux-gcc (GCC) 12.1.0
reproduce:
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# apt-get install sparse
# sparse version: v0.6.4-39-gce1a6720-dirty
# https://github.com/intel-lab-lkp/linux/commit/9dec20bda1c5d0d7a203d393fc1ffa6e296579a9
git remote add linux-review https://github.com/intel-lab-lkp/linux
git fetch --no-tags linux-review Peng-Zhang/sched-fair-optimize-entity_tick/20220718-175245
git checkout 9dec20bda1c5d0d7a203d393fc1ffa6e296579a9
# save the config file
mkdir build_dir && cp config build_dir/.config
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' O=build_dir ARCH=nios2 SHELL=/bin/bash drivers/target/ kernel/sched/
If you fix the issue, kindly add following tag where applicable
Reported-by: kernel test robot <lkp@intel.com>
sparse warnings: (new ones prefixed by >>)
kernel/sched/fair.c:927:34: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected struct sched_entity *se @@ got struct sched_entity [noderef] __rcu * @@
kernel/sched/fair.c:927:34: sparse: expected struct sched_entity *se
kernel/sched/fair.c:927:34: sparse: got struct sched_entity [noderef] __rcu *
>> kernel/sched/fair.c:4760:75: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected struct task_struct *tsk @@ got struct task_struct [noderef] __rcu *curr @@
kernel/sched/fair.c:4760:75: sparse: expected struct task_struct *tsk
kernel/sched/fair.c:4760:75: sparse: got struct task_struct [noderef] __rcu *curr
kernel/sched/fair.c:5663:38: sparse: sparse: incorrect type in initializer (different address spaces) @@ expected struct task_struct *curr @@ got struct task_struct [noderef] __rcu *curr @@
kernel/sched/fair.c:5663:38: sparse: expected struct task_struct *curr
kernel/sched/fair.c:5663:38: sparse: got struct task_struct [noderef] __rcu *curr
kernel/sched/fair.c:7232:38: sparse: sparse: incorrect type in initializer (different address spaces) @@ expected struct task_struct *curr @@ got struct task_struct [noderef] __rcu *curr @@
kernel/sched/fair.c:7232:38: sparse: expected struct task_struct *curr
kernel/sched/fair.c:7232:38: sparse: got struct task_struct [noderef] __rcu *curr
kernel/sched/fair.c:7530:38: sparse: sparse: incorrect type in initializer (different address spaces) @@ expected struct task_struct *curr @@ got struct task_struct [noderef] __rcu *curr @@
kernel/sched/fair.c:7530:38: sparse: expected struct task_struct *curr
kernel/sched/fair.c:7530:38: sparse: got struct task_struct [noderef] __rcu *curr
kernel/sched/fair.c:5592:35: sparse: sparse: marked inline, but without a definition
kernel/sched/fair.c: note: in included file:
kernel/sched/sched.h:2053:25: sparse: sparse: incompatible types in comparison expression (different address spaces):
kernel/sched/sched.h:2053:25: sparse: struct task_struct [noderef] __rcu *
kernel/sched/sched.h:2053:25: sparse: struct task_struct *
kernel/sched/sched.h:2210:9: sparse: sparse: incompatible types in comparison expression (different address spaces):
kernel/sched/sched.h:2210:9: sparse: struct task_struct [noderef] __rcu *
kernel/sched/sched.h:2210:9: sparse: struct task_struct *
kernel/sched/sched.h:2053:25: sparse: sparse: incompatible types in comparison expression (different address spaces):
kernel/sched/sched.h:2053:25: sparse: struct task_struct [noderef] __rcu *
kernel/sched/sched.h:2053:25: sparse: struct task_struct *
kernel/sched/sched.h:2053:25: sparse: sparse: incompatible types in comparison expression (different address spaces):
kernel/sched/sched.h:2053:25: sparse: struct task_struct [noderef] __rcu *
kernel/sched/sched.h:2053:25: sparse: struct task_struct *
vim +4760 kernel/sched/fair.c
4759
> 4760 if (cfs_rq->nr_running > 1 && !test_tsk_need_resched(rq_of(cfs_rq)->curr))
4761 check_preempt_tick(cfs_rq, curr);
4762 }
4763
--
0-DAY CI Kernel Test Service
https://01.org/lkp
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2022-07-18 18:53 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-07-18 9:49 [PATCH] sched/fair: optimize entity_tick() Peng Zhang
2022-07-18 10:10 ` Peter Zijlstra
2022-07-18 18:53 ` kernel test robot
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®