[cgroup:review-iow 15/17] block/blk-ioweight.c:263:24: warning: integer overflow in expression

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



tree:   https://git.kernel.org/pub/scm/linux/kernel/git/tj/cgroup.git review-iow
head:   e2209ac1daf46cd980f6b912c30a910a78f7da24
commit: 3ddd9fc7fba6e817f95c3baa7731826a3e6cbd2c [15/17] blkcg: implement blk-ioweight
config: sh-allmodconfig (attached as .config)
compiler: sh4-linux-gcc (GCC) 7.4.0
reproduce:
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        git checkout 3ddd9fc7fba6e817f95c3baa7731826a3e6cbd2c
        # save the attached .config to linux build tree
        GCC_VERSION=7.4.0 make.cross ARCH=sh 

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

All warnings (new ones prefixed by >>):

>> block/blk-ioweight.c:263:24: warning: integer overflow in expression [-Woverflow]
     AUTOP_CYCLE_NSEC = 10 * NSEC_PER_SEC,
                           ^
>> block/blk-ioweight.c:557:4: warning: this decimal constant is unsigned only in ISO C90
       [I_LCOEF_RBPS]  =    2338259289,
       ^

vim +263 block/blk-ioweight.c

   183	
   184	enum {
   185		MILLION			= 1000000,
   186	
   187		/* timer period is calculated from latency requirements, bound it */
   188		MIN_PERIOD		= USEC_PER_MSEC,
   189		MAX_PERIOD		= USEC_PER_SEC,
   190	
   191		/*
   192		 * A cgroup's vtime can run 50% behind the device vtime, which
   193		 * serves as its IO credit buffer.  Surplus weight adjustment is
   194		 * immediately canceled if the vtime margin runs below 10%.
   195		 */
   196		MARGIN_PCT		= 50,
   197		INUSE_MARGIN_PCT	= 10,
   198	
   199		/* Have some play in waitq timer operations */
   200		WAITQ_TIMER_MARGIN_PCT	= 5,
   201	
   202		/*
   203		 * vtime can wrap well within a reasonable uptime when vrate is
   204		 * consistently raised.  Don't trust recorded cgroup vtime if the
   205		 * period counter indicates that it's older than 5mins.
   206		 */
   207		VTIME_VALID_DUR		= 300 * USEC_PER_SEC,
   208	
   209		/*
   210		 * Remember the past three non-zero usages and use the max for
   211		 * surplus calculation.  Three slots guarantee that we remember one
   212		 * full period usage from the last active stretch even after
   213		 * partial deactivation and re-activation periods.  Don't start
   214		 * giving away weight before collecting two data points to prevent
   215		 * hweight adjustments based on one partial activation period.
   216		 */
   217		NR_USAGE_SLOTS		= 3,
   218		MIN_VALID_USAGES	= 2,
   219	
   220		/* 1/64k is granular enough and can easily be handled w/ u32 */
   221		HWEIGHT_WHOLE		= 1 << 16,
   222	
   223		/*
   224		 * As vtime is used to calculate the cost of each IO, it needs to
   225		 * be fairly high precision.  For example, it should be able to
   226		 * represent the cost of a single page worth of discard with
   227		 * suffificient accuracy.  At the same time, it should be able to
   228		 * represent reasonably long enough durations to be useful and
   229		 * convenient during operation.
   230		 *
   231		 * 1s worth of vtime is 2^37.  This gives us both sub-nanosecond
   232		 * granularity and days of wrap-around time even at extreme vrates.
   233		 */
   234		VTIME_PER_SEC_SHIFT	= 37,
   235		VTIME_PER_SEC		= 1LLU << VTIME_PER_SEC_SHIFT,
   236		VTIME_PER_USEC		= VTIME_PER_SEC / USEC_PER_SEC,
   237	
   238		/* bound vrate adjustments within two orders of magnitude */
   239		VRATE_MIN_PPM		= 10000,	/* 1% */
   240		VRATE_MAX_PPM		= 100000000,	/* 10000% */
   241	
   242		VRATE_MIN		= VTIME_PER_USEC * VRATE_MIN_PPM / MILLION,
   243		VRATE_CLAMP_ADJ_PCT	= 4,
   244	
   245		/* if IOs end up waiting for requests, issue less */
   246		RQ_WAIT_BUSY_PCT	= 5,
   247	
   248		/* unbusy hysterisis */
   249		UNBUSY_THR_PCT		= 75,
   250	
   251		/* don't let cmds which take a very long time pin lagging for too long */
   252		MAX_LAGGING_PERIODS	= 10,
   253	
   254		/*
   255		 * If usage% * 1.25 + 2% is lower than hweight% by more than 3%,
   256		 * donate the surplus.
   257		 */
   258		SURPLUS_SCALE_PCT	= 125,			/* * 125% */
   259		SURPLUS_SCALE_ABS	= HWEIGHT_WHOLE / 50,	/* + 2% */
   260		SURPLUS_MIN_ADJ_DELTA	= HWEIGHT_WHOLE / 33,	/* 3% */
   261	
   262		/* switch iff the conditions are met for longer than this */
 > 263		AUTOP_CYCLE_NSEC	= 10 * NSEC_PER_SEC,
   264	
   265		/*
   266		 * Count IO size in 4k pages.  The 12bit shift helps keeping
   267		 * size-proportional components of cost calculation in closer
   268		 * numbers of digits to per-IO cost components.
   269		 */
   270		IOW_PAGE_SHIFT		= 12,
   271		IOW_PAGE_SIZE		= 1 << IOW_PAGE_SHIFT,
   272		IOW_SECT_TO_PAGE_SHIFT	= IOW_PAGE_SHIFT - SECTOR_SHIFT,
   273	
   274		/* if apart further than 16M, consider randio for linear model */
   275		LCOEF_RANDIO_PAGES	= 4096,
   276	};
   277	

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

Attachment: .config.gz
Description: application/gzip


[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]     [Monitors]

  Powered by Linux