[tip:sched/core 14/47] kernel/sched/fair.c:893:22: error: variable 'p' set but not used

From: kernel test robot
Date: Mon Oct 11 2021 - 23:58:21 EST


tree: https://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git sched/core
head: b2d5b9cec60fecc72a13191c2c6c05acf60975a5
commit: 60f2415e19d3948641149ac6aca137a7be1d1952 [14/47] sched: Make schedstats helpers independent of fair sched class
config: hexagon-buildonly-randconfig-r002-20211012 (attached as .config)
compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project c3dcf39554dbea780d6cb7e12239451ba47a2668)
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# https://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git/commit/?id=60f2415e19d3948641149ac6aca137a7be1d1952
git remote add tip https://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git
git fetch --no-tags tip sched/core
git checkout 60f2415e19d3948641149ac6aca137a7be1d1952
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 ARCH=hexagon

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@xxxxxxxxx>

All errors (new ones prefixed by >>):

kernel/sched/fair.c:860:28: error: variable 'stats' set but not used [-Werror,-Wunused-but-set-variable]
struct sched_statistics *stats;
^
kernel/sched/fair.c:892:27: error: variable 'stats' set but not used [-Werror,-Wunused-but-set-variable]
struct sched_statistics *stats;
^
>> kernel/sched/fair.c:893:22: error: variable 'p' set but not used [-Werror,-Wunused-but-set-variable]
struct task_struct *p = NULL;
^
kernel/sched/fair.c:910:22: error: variable 'p' set but not used [-Werror,-Wunused-but-set-variable]
struct task_struct *p = NULL;
^
kernel/sched/fair.c:909:27: error: variable 'stats' set but not used [-Werror,-Wunused-but-set-variable]
struct sched_statistics *stats;
^
>> kernel/sched/fair.c:936:22: error: variable 'tsk' set but not used [-Werror,-Wunused-but-set-variable]
struct task_struct *tsk = NULL;
^
kernel/sched/fair.c:935:27: error: variable 'stats' set but not used [-Werror,-Wunused-but-set-variable]
struct sched_statistics *stats;
^
kernel/sched/fair.c:4451:28: error: variable 'stats' set but not used [-Werror,-Wunused-but-set-variable]
struct sched_statistics *stats;
^
8 errors generated.


vim +/p +893 kernel/sched/fair.c

840
841 /*
842 * Update the current task's runtime statistics.
843 */
844 static void update_curr(struct cfs_rq *cfs_rq)
845 {
846 struct sched_entity *curr = cfs_rq->curr;
847 u64 now = rq_clock_task(rq_of(cfs_rq));
848 u64 delta_exec;
849
850 if (unlikely(!curr))
851 return;
852
853 delta_exec = now - curr->exec_start;
854 if (unlikely((s64)delta_exec <= 0))
855 return;
856
857 curr->exec_start = now;
858
859 if (schedstat_enabled()) {
> 860 struct sched_statistics *stats;
861
862 stats = __schedstats_from_se(curr);
863 __schedstat_set(stats->exec_max,
864 max(delta_exec, stats->exec_max));
865 }
866
867 curr->sum_exec_runtime += delta_exec;
868 schedstat_add(cfs_rq->exec_clock, delta_exec);
869
870 curr->vruntime += calc_delta_fair(delta_exec, curr);
871 update_min_vruntime(cfs_rq);
872
873 if (entity_is_task(curr)) {
874 struct task_struct *curtask = task_of(curr);
875
876 trace_sched_stat_runtime(curtask, delta_exec, curr->vruntime);
877 cgroup_account_cputime(curtask, delta_exec);
878 account_group_exec_runtime(curtask, delta_exec);
879 }
880
881 account_cfs_rq_runtime(cfs_rq, delta_exec);
882 }
883
884 static void update_curr_fair(struct rq *rq)
885 {
886 update_curr(cfs_rq_of(&rq->curr->se));
887 }
888
889 static inline void
890 update_stats_wait_start_fair(struct cfs_rq *cfs_rq, struct sched_entity *se)
891 {
892 struct sched_statistics *stats;
> 893 struct task_struct *p = NULL;
894
895 if (!schedstat_enabled())
896 return;
897
898 stats = __schedstats_from_se(se);
899
900 if (entity_is_task(se))
901 p = task_of(se);
902
903 __update_stats_wait_start(rq_of(cfs_rq), p, stats);
904 }
905
906 static inline void
907 update_stats_wait_end_fair(struct cfs_rq *cfs_rq, struct sched_entity *se)
908 {
909 struct sched_statistics *stats;
910 struct task_struct *p = NULL;
911
912 if (!schedstat_enabled())
913 return;
914
915 stats = __schedstats_from_se(se);
916
917 /*
918 * When the sched_schedstat changes from 0 to 1, some sched se
919 * maybe already in the runqueue, the se->statistics.wait_start
920 * will be 0.So it will let the delta wrong. We need to avoid this
921 * scenario.
922 */
923 if (unlikely(!schedstat_val(stats->wait_start)))
924 return;
925
926 if (entity_is_task(se))
927 p = task_of(se);
928
929 __update_stats_wait_end(rq_of(cfs_rq), p, stats);
930 }
931
932 static inline void
933 update_stats_enqueue_sleeper_fair(struct cfs_rq *cfs_rq, struct sched_entity *se)
934 {
935 struct sched_statistics *stats;
> 936 struct task_struct *tsk = NULL;
937
938 if (!schedstat_enabled())
939 return;
940
941 stats = __schedstats_from_se(se);
942
943 if (entity_is_task(se))
944 tsk = task_of(se);
945
946 __update_stats_enqueue_sleeper(rq_of(cfs_rq), tsk, stats);
947 }
948

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@xxxxxxxxxxxx

Attachment: .config.gz
Description: application/gzip