Re: [PATCH 2/3] mm: memcg: plumbing memcg for kmalloc allocations

From: kbuild test robot
Date: Tue Feb 20 2018 - 19:51:04 EST


Hi Shakeel,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on mmotm/master]
[also build test ERROR on v4.16-rc2 next-20180220]
[cannot apply to linus/master]
[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/Shakeel-Butt/Directed-kmem-charging/20180221-071026
base: git://git.cmpxchg.org/linux-mmotm.git master
config: i386-randconfig-n0-201807 (attached as .config)
compiler: gcc-7 (Debian 7.3.0-1) 7.3.0
reproduce:
# save the attached .config to linux build tree
make ARCH=i386

All errors (new ones prefixed by >>):

init/initramfs.o: In function `kmalloc_memcg':
>> include/linux/slab.h:588: undefined reference to `__kmalloc_memcg'
>> include/linux/slab.h:588: undefined reference to `__kmalloc_memcg'
arch/x86/events/core.o: In function `kmalloc_memcg':
>> include/linux/slab.h:588: undefined reference to `__kmalloc_memcg'
>> include/linux/slab.h:588: undefined reference to `__kmalloc_memcg'
arch/x86/kernel/ksysfs.o: In function `kmalloc_memcg':
>> include/linux/slab.h:588: undefined reference to `__kmalloc_memcg'
arch/x86/kernel/e820.o:include/linux/slab.h:588: more undefined references to `__kmalloc_memcg' follow

vim +588 include/linux/slab.h

518
519 /**
520 * kmalloc - allocate memory
521 * @size: how many bytes of memory are required.
522 * @flags: the type of memory to allocate.
523 *
524 * kmalloc is the normal method of allocating memory
525 * for objects smaller than page size in the kernel.
526 *
527 * The @flags argument may be one of:
528 *
529 * %GFP_USER - Allocate memory on behalf of user. May sleep.
530 *
531 * %GFP_KERNEL - Allocate normal kernel ram. May sleep.
532 *
533 * %GFP_ATOMIC - Allocation will not sleep. May use emergency pools.
534 * For example, use this inside interrupt handlers.
535 *
536 * %GFP_HIGHUSER - Allocate pages from high memory.
537 *
538 * %GFP_NOIO - Do not do any I/O at all while trying to get memory.
539 *
540 * %GFP_NOFS - Do not make any fs calls while trying to get memory.
541 *
542 * %GFP_NOWAIT - Allocation will not sleep.
543 *
544 * %__GFP_THISNODE - Allocate node-local memory only.
545 *
546 * %GFP_DMA - Allocation suitable for DMA.
547 * Should only be used for kmalloc() caches. Otherwise, use a
548 * slab created with SLAB_DMA.
549 *
550 * Also it is possible to set different flags by OR'ing
551 * in one or more of the following additional @flags:
552 *
553 * %__GFP_HIGH - This allocation has high priority and may use emergency pools.
554 *
555 * %__GFP_NOFAIL - Indicate that this allocation is in no way allowed to fail
556 * (think twice before using).
557 *
558 * %__GFP_NORETRY - If memory is not immediately available,
559 * then give up at once.
560 *
561 * %__GFP_NOWARN - If allocation fails, don't issue any warnings.
562 *
563 * %__GFP_RETRY_MAYFAIL - Try really hard to succeed the allocation but fail
564 * eventually.
565 *
566 * There are other flags available as well, but these are not intended
567 * for general use, and so are not documented here. For a full list of
568 * potential flags, always refer to linux/gfp.h.
569 */
570 static __always_inline void *
571 kmalloc_memcg(size_t size, gfp_t flags, struct mem_cgroup *memcg)
572 {
573 if (__builtin_constant_p(size)) {
574 if (size > KMALLOC_MAX_CACHE_SIZE)
575 return kmalloc_large_memcg(size, flags, memcg);
576 #ifndef CONFIG_SLOB
577 if (!(flags & GFP_DMA)) {
578 int index = kmalloc_index(size);
579
580 if (!index)
581 return ZERO_SIZE_PTR;
582
583 return kmem_cache_alloc_memcg_trace(
584 kmalloc_caches[index], flags, size, memcg);
585 }
586 #endif
587 }
> 588 return __kmalloc_memcg(size, flags, memcg);
589 }
590

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

Attachment: .config.gz
Description: application/gzip