[PATCH 3/5] ttm: add initial memcg integration. (v2)
kernel test robot
lkp at intel.com
Sat May 3 02:09:51 UTC 2025
Hi Dave,
kernel test robot noticed the following build errors:
[auto build test ERROR on tj-cgroup/for-next]
[also build test ERROR on akpm-mm/mm-everything linus/master v6.15-rc4]
[cannot apply to drm-misc/drm-misc-next drm-tip/drm-tip next-20250502]
[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/Dave-Airlie/memcg-add-hooks-for-gpu-memcg-charging-uncharging/20250502-123650
base: https://git.kernel.org/pub/scm/linux/kernel/git/tj/cgroup.git for-next
patch link: https://lore.kernel.org/r/20250502034046.1625896-4-airlied%40gmail.com
patch subject: [PATCH 3/5] ttm: add initial memcg integration. (v2)
config: s390-randconfig-001-20250503 (https://download.01.org/0day-ci/archive/20250503/202505030927.6cZ0SdOU-lkp@intel.com/config)
compiler: s390-linux-gcc (GCC) 7.5.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250503/202505030927.6cZ0SdOU-lkp@intel.com/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp at intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202505030927.6cZ0SdOU-lkp@intel.com/
All errors (new ones prefixed by >>):
s390-linux-ld: drivers/gpu/drm/ttm/ttm_resource.o: in function `ttm_resource_free':
>> drivers/gpu/drm/ttm/ttm_resource.c:443: undefined reference to `mem_cgroup_uncharge_gpu'
s390-linux-ld: drivers/gpu/drm/ttm/ttm_resource.o: in function `ttm_resource_alloc':
drivers/gpu/drm/ttm/ttm_resource.c:408: undefined reference to `mem_cgroup_uncharge_gpu'
>> s390-linux-ld: drivers/gpu/drm/ttm/ttm_resource.c:400: undefined reference to `mem_cgroup_charge_gpu'
vim +443 drivers/gpu/drm/ttm/ttm_resource.c
374
375 int ttm_resource_alloc(struct ttm_buffer_object *bo,
376 const struct ttm_place *place,
377 struct ttm_operation_ctx *ctx,
378 struct ttm_resource **res_ptr,
379 struct dmem_cgroup_pool_state **ret_limit_pool)
380 {
381 struct ttm_resource_manager *man =
382 ttm_manager_type(bo->bdev, place->mem_type);
383 struct dmem_cgroup_pool_state *pool = NULL;
384 struct mem_cgroup *memcg = NULL;
385 int ret;
386
387 if (man->cg) {
388 ret = dmem_cgroup_try_charge(man->cg, bo->base.size, &pool, ret_limit_pool);
389 if (ret)
390 return ret;
391 }
392
393 if ((place->mem_type == TTM_PL_SYSTEM || place->mem_type == TTM_PL_TT) &&
394 ctx->account_op && bo->memcg) {
395 memcg = bo->memcg;
396 gfp_t gfp_flags = GFP_USER;
397 if (ctx->gfp_retry_mayfail)
398 gfp_flags |= __GFP_RETRY_MAYFAIL;
399
> 400 if (!mem_cgroup_charge_gpu(memcg, bo->base.size >> PAGE_SHIFT, gfp_flags))
401 return -ENOMEM;
402 }
403 ret = man->func->alloc(man, bo, place, res_ptr);
404 if (ret) {
405 if (pool)
406 dmem_cgroup_uncharge(pool, bo->base.size);
407 if (memcg)
408 mem_cgroup_uncharge_gpu(memcg, bo->base.size >> PAGE_SHIFT);
409 return ret;
410 }
411
412 (*res_ptr)->memcg = memcg;
413 (*res_ptr)->css = pool;
414
415 spin_lock(&bo->bdev->lru_lock);
416 ttm_resource_add_bulk_move(*res_ptr, bo);
417 spin_unlock(&bo->bdev->lru_lock);
418 return 0;
419 }
420 EXPORT_SYMBOL_FOR_TESTS_ONLY(ttm_resource_alloc);
421
422 void ttm_resource_free(struct ttm_buffer_object *bo, struct ttm_resource **res)
423 {
424 struct ttm_resource_manager *man;
425 struct dmem_cgroup_pool_state *pool;
426 struct mem_cgroup *memcg;
427
428 if (!*res)
429 return;
430
431 spin_lock(&bo->bdev->lru_lock);
432 ttm_resource_del_bulk_move(*res, bo);
433 spin_unlock(&bo->bdev->lru_lock);
434
435 pool = (*res)->css;
436 memcg = (*res)->memcg;
437 man = ttm_manager_type(bo->bdev, (*res)->mem_type);
438 man->func->free(man, *res);
439 *res = NULL;
440 if (man->cg)
441 dmem_cgroup_uncharge(pool, bo->base.size);
442 if (memcg)
> 443 mem_cgroup_uncharge_gpu(memcg, bo->base.size >> PAGE_SHIFT);
444 }
445 EXPORT_SYMBOL(ttm_resource_free);
446
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
More information about the dri-devel
mailing list