[PATCH] drm/ttm: check if free mem space is under the lower limit

kbuild test robot lkp at intel.com
Fri Feb 23 08:49:26 UTC 2018


Hi Roger,

I love your patch! Perhaps something to improve:

[auto build test WARNING on drm/drm-next]
[also build test WARNING on v4.16-rc2 next-20180223]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/Roger-He/drm-ttm-check-if-free-mem-space-is-under-the-lower-limit/20180223-132039
base:   git://people.freedesktop.org/~airlied/linux.git drm-next
config: i386-randconfig-b0-02231423 (attached as .config)
compiler: gcc-4.9 (Debian 4.9.4-2) 4.9.4
reproduce:
        # save the attached .config to linux build tree
        make ARCH=i386 

All warnings (new ones prefixed by >>):

   In file included from include/linux/kernel.h:10:0,
                    from include/linux/list.h:9,
                    from include/linux/timer.h:5,
                    from include/linux/workqueue.h:9,
                    from include/drm/ttm/ttm_memory.h:31,
                    from drivers/gpu/drm/ttm/ttm_memory.c:30:
   drivers/gpu/drm/ttm/ttm_memory.c: In function 'ttm_check_under_lowerlimit':
   drivers/gpu/drm/ttm/ttm_memory.c:554:9: error: 'struct ttm_operation_ctx' has no member named 'flags'
     if (ctx->flags & TTM_OPT_FLAG_FORCE_ALLOC)
            ^
   include/linux/compiler.h:58:30: note: in definition of macro '__trace_if'
     if (__builtin_constant_p(!!(cond)) ? !!(cond) :   \
                                 ^
>> drivers/gpu/drm/ttm/ttm_memory.c:554:2: note: in expansion of macro 'if'
     if (ctx->flags & TTM_OPT_FLAG_FORCE_ALLOC)
     ^
   drivers/gpu/drm/ttm/ttm_memory.c:554:19: error: 'TTM_OPT_FLAG_FORCE_ALLOC' undeclared (first use in this function)
     if (ctx->flags & TTM_OPT_FLAG_FORCE_ALLOC)
                      ^
   include/linux/compiler.h:58:30: note: in definition of macro '__trace_if'
     if (__builtin_constant_p(!!(cond)) ? !!(cond) :   \
                                 ^
>> drivers/gpu/drm/ttm/ttm_memory.c:554:2: note: in expansion of macro 'if'
     if (ctx->flags & TTM_OPT_FLAG_FORCE_ALLOC)
     ^
   drivers/gpu/drm/ttm/ttm_memory.c:554:19: note: each undeclared identifier is reported only once for each function it appears in
     if (ctx->flags & TTM_OPT_FLAG_FORCE_ALLOC)
                      ^
   include/linux/compiler.h:58:30: note: in definition of macro '__trace_if'
     if (__builtin_constant_p(!!(cond)) ? !!(cond) :   \
                                 ^
>> drivers/gpu/drm/ttm/ttm_memory.c:554:2: note: in expansion of macro 'if'
     if (ctx->flags & TTM_OPT_FLAG_FORCE_ALLOC)
     ^
   drivers/gpu/drm/ttm/ttm_memory.c:554:9: error: 'struct ttm_operation_ctx' has no member named 'flags'
     if (ctx->flags & TTM_OPT_FLAG_FORCE_ALLOC)
            ^
   include/linux/compiler.h:58:42: note: in definition of macro '__trace_if'
     if (__builtin_constant_p(!!(cond)) ? !!(cond) :   \
                                             ^
>> drivers/gpu/drm/ttm/ttm_memory.c:554:2: note: in expansion of macro 'if'
     if (ctx->flags & TTM_OPT_FLAG_FORCE_ALLOC)
     ^
   drivers/gpu/drm/ttm/ttm_memory.c:554:9: error: 'struct ttm_operation_ctx' has no member named 'flags'
     if (ctx->flags & TTM_OPT_FLAG_FORCE_ALLOC)
            ^
   include/linux/compiler.h:69:16: note: in definition of macro '__trace_if'
      ______r = !!(cond);     \
                   ^
>> drivers/gpu/drm/ttm/ttm_memory.c:554:2: note: in expansion of macro 'if'
     if (ctx->flags & TTM_OPT_FLAG_FORCE_ALLOC)
     ^

vim +/if +554 drivers/gpu/drm/ttm/ttm_memory.c

   535	
   536	/*
   537	 * check if the available mem is under lower memory limit
   538	 *
   539	 * a. if no swap disk at all or free swap space is under swap_mem_limit
   540	 * but available system mem is bigger than sys_mem_limit, allow TTM
   541	 * allocation;
   542	 *
   543	 * b. if the available system mem is less than sys_mem_limit but free
   544	 * swap disk is bigger than swap_mem_limit, allow TTM allocation.
   545	 */
   546	bool
   547	ttm_check_under_lowerlimit(struct ttm_mem_global *glob,
   548				uint64_t num_pages,
   549				struct ttm_operation_ctx *ctx)
   550	{
   551		bool ret = false;
   552		int64_t available;
   553	
 > 554		if (ctx->flags & TTM_OPT_FLAG_FORCE_ALLOC)
   555			return false;
   556	
   557		available = get_nr_swap_pages() + si_mem_available();
   558		available -= num_pages;
   559		if (available < glob->lower_mem_limit)
   560			ret = true;
   561	
   562		return ret;
   563	}
   564	EXPORT_SYMBOL(ttm_check_under_lowerlimit);
   565	

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation
-------------- next part --------------
A non-text attachment was scrubbed...
Name: .config.gz
Type: application/gzip
Size: 24960 bytes
Desc: not available
URL: <https://lists.freedesktop.org/archives/dri-devel/attachments/20180223/fa09ae45/attachment-0001.gz>


More information about the dri-devel mailing list