[peterz-queue:sched/core 14/19] kernel/sched/fair.c:893:29: warning: variable 'p' set but not used

From: kernel test robot
Date: Fri Sep 10 2021 - 14:30:58 EST


tree: https://git.kernel.org/pub/scm/linux/kernel/git/peterz/queue.git sched/core
head: 2dfdb3d20ad50e2ae2cb84cbceb0f0fc75e79e5d
commit: 0dc533504723599b41a4cefc6697379cddf55787 [14/19] sched: make schedstats helpers independent of fair sched class
config: m68k-buildonly-randconfig-r002-20210910 (attached as .config)
compiler: m68k-linux-gcc (GCC) 11.2.0
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/peterz/queue.git/commit/?id=0dc533504723599b41a4cefc6697379cddf55787
git remote add peterz-queue https://git.kernel.org/pub/scm/linux/kernel/git/peterz/queue.git
git fetch --no-tags peterz-queue sched/core
git checkout 0dc533504723599b41a4cefc6697379cddf55787
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross ARCH=m68k

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

All warnings (new ones prefixed by >>):

kernel/sched/fair.c: In function 'update_stats_wait_start_fair':
>> kernel/sched/fair.c:893:29: warning: variable 'p' set but not used [-Wunused-but-set-variable]
893 | struct task_struct *p = NULL;
| ^
kernel/sched/fair.c:892:34: warning: variable 'stats' set but not used [-Wunused-but-set-variable]
892 | struct sched_statistics *stats;
| ^~~~~
kernel/sched/fair.c: In function 'update_stats_wait_end_fair':
kernel/sched/fair.c:910:29: warning: variable 'p' set but not used [-Wunused-but-set-variable]
910 | struct task_struct *p = NULL;
| ^
kernel/sched/fair.c:909:34: warning: variable 'stats' set but not used [-Wunused-but-set-variable]
909 | struct sched_statistics *stats;
| ^~~~~
kernel/sched/fair.c: In function 'update_stats_enqueue_sleeper_fair':
>> kernel/sched/fair.c:936:29: warning: variable 'tsk' set but not used [-Wunused-but-set-variable]
936 | struct task_struct *tsk = NULL;
| ^~~
kernel/sched/fair.c:935:34: warning: variable 'stats' set but not used [-Wunused-but-set-variable]
935 | struct sched_statistics *stats;
| ^~~~~
kernel/sched/fair.c: At top level:
kernel/sched/fair.c:5411:6: warning: no previous prototype for 'init_cfs_bandwidth' [-Wmissing-prototypes]
5411 | void init_cfs_bandwidth(struct cfs_bandwidth *cfs_b) {}
| ^~~~~~~~~~~~~~~~~~
kernel/sched/fair.c:11567:6: warning: no previous prototype for 'free_fair_sched_group' [-Wmissing-prototypes]
11567 | void free_fair_sched_group(struct task_group *tg) { }
| ^~~~~~~~~~~~~~~~~~~~~
kernel/sched/fair.c:11569:5: warning: no previous prototype for 'alloc_fair_sched_group' [-Wmissing-prototypes]
11569 | int alloc_fair_sched_group(struct task_group *tg, struct task_group *parent)
| ^~~~~~~~~~~~~~~~~~~~~~
kernel/sched/fair.c:11574:6: warning: no previous prototype for 'online_fair_sched_group' [-Wmissing-prototypes]
11574 | void online_fair_sched_group(struct task_group *tg) { }
| ^~~~~~~~~~~~~~~~~~~~~~~
kernel/sched/fair.c:11576:6: warning: no previous prototype for 'unregister_fair_sched_group' [-Wmissing-prototypes]
11576 | void unregister_fair_sched_group(struct task_group *tg) { }
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~


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

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