Linux-arch Archive mirror
 help / color / mirror / Atom feed
From: Klara Modin <klarasmodin@gmail.com>
To: Kent Overstreet <kent.overstreet@linux.dev>
Cc: Suren Baghdasaryan <surenb@google.com>,
	akpm@linux-foundation.org, mhocko@suse.com, vbabka@suse.cz,
	hannes@cmpxchg.org, roman.gushchin@linux.dev, mgorman@suse.de,
	dave@stgolabs.net, willy@infradead.org, liam.howlett@oracle.com,
	penguin-kernel@i-love.sakura.ne.jp, corbet@lwn.net,
	void@manifault.com,
	"Peter Zijlstra (Intel)" <peterz@infradead.org>,
	juri.lelli@redhat.com, catalin.marinas@arm.com, will@kernel.org,
	arnd@arndb.de, tglx@linutronix.de, mingo@redhat.com,
	dave.hansen@linux.intel.com, x86@kernel.org, peterx@redhat.com,
	david@redhat.com, axboe@kernel.dk, mcgrof@kernel.org,
	masahiroy@kernel.org, Nathan Chancellor <nathan@kernel.org>,
	dennis@kernel.org, jhubbard@nvidia.com, tj@kernel.org,
	muchun.song@linux.dev, rppt@kernel.org, paulmck@kernel.org,
	pasha.tatashin@soleen.com, yosryahmed@google.com,
	yuzhao@google.com, David Howells <dhowells@redhat.com>,
	hughd@google.com, andreyknvl@gmail.com, keescook@chromium.org,
	ndesaulniers@google.com, vvvvvv@google.com,
	gregkh@linuxfoundation.org, ebiggers@google.com,
	ytcoode@gmail.com, vincent.guittot@linaro.org,
	dietmar.eggemann@arm.com, rostedt@goodmis.org,
	bsegall@google.com, bristot@redhat.com, vschneid@redhat.com,
	cl@linux.com, penberg@kernel.org, iamjoonsoo.kim@lge.com,
	42.hyeyoo@gmail.com, glider@google.com, elver@google.com,
	dvyukov@google.com, songmuchun@bytedance.com, jbaron@akamai.com,
	aliceryhl@google.com, rientjes@google.com, minchan@google.com,
	kaleshsingh@google.com, kernel-team@android.com,
	linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org,
	iommu@lists.linux.dev, linux-arch@vger.kernel.org,
	linux-fsdevel@vger.kernel.org, linux-mm@kvack.org,
	linux-modules@vger.kernel.org, kasan-dev@googlegroups.com,
	cgroups@vger.kernel.org
Subject: Re: [PATCH v6 13/37] lib: add allocation tagging support for memory allocation profiling
Date: Sun, 7 Apr 2024 18:50:51 +0200	[thread overview]
Message-ID: <2200255e-4db5-4a45-a032-c2bc02617caa@gmail.com> (raw)
In-Reply-To: <acfdf9d8-630b-41d1-9ae0-b3b6442df82c@gmail.com>

[-- Attachment #1: Type: text/plain, Size: 2215 bytes --]

On 2024-04-07 15:44, Klara Modin wrote:
> On 2024-04-06 23:47, Kent Overstreet wrote:
>> On Fri, Apr 05, 2024 at 03:54:45PM +0200, Klara Modin wrote:
>>> Hi,
>>>
>>> On 2024-03-21 17:36, Suren Baghdasaryan wrote:
>>>> Introduce CONFIG_MEM_ALLOC_PROFILING which provides definitions to 
>>>> easily
>>>> instrument memory allocators. It registers an "alloc_tags" codetag type
>>>> with /proc/allocinfo interface to output allocation tag information 
>>>> when
>>>> the feature is enabled.
>>>> CONFIG_MEM_ALLOC_PROFILING_DEBUG is provided for debugging the memory
>>>> allocation profiling instrumentation.
>>>> Memory allocation profiling can be enabled or disabled at runtime using
>>>> /proc/sys/vm/mem_profiling sysctl when 
>>>> CONFIG_MEM_ALLOC_PROFILING_DEBUG=n.
>>>> CONFIG_MEM_ALLOC_PROFILING_ENABLED_BY_DEFAULT enables memory allocation
>>>> profiling by default.
>>>>
>>>> Signed-off-by: Suren Baghdasaryan <surenb@google.com>
>>>> Co-developed-by: Kent Overstreet <kent.overstreet@linux.dev>
>>>> Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
>>>
>>> With this commit (9e2dcefa791e9d14006b360fba3455510fd3325d in
>>> next-20240404), randconfig with KCONFIG_SEED=0xE6264236 fails to build
>>> with the attached error. The following patch fixes the build error 
>>> for me,
>>> but I don't know if it's correct.
>>
>> Looks good - if you sound out an official patch I'll ack it.
>>
> 
> I gave it a try and sent out a patch [1]. This is my first time doing 
> that and it's likely not without mistakes.
> 
> 1. 
> https://lore.kernel.org/lkml/20240407133252.173636-1-klarasmodin@gmail.com/T/#u

linux/smp.h may be needed as well. I tried cross-compiling the 
randconfig for riscv which complains of missing raw_smp_processor_id() 
and including linux/smp.h resolves that.

Does this look reasonable, and if so, should I send it as well?

diff --git a/include/linux/alloc_tag.h b/include/linux/alloc_tag.h
index afc9e259a2d3..7fe1cbdab0b0 100644
--- a/include/linux/alloc_tag.h
+++ b/include/linux/alloc_tag.h
@@ -13,6 +13,7 @@
  #include <linux/cpumask.h>
  #include <linux/static_key.h>
  #include <linux/irqflags.h>
+#include <linux/smp.h>

  struct alloc_tag_counters {
         u64 bytes;

[-- Attachment #2: randconfig-riscv.gz --]
[-- Type: application/gzip, Size: 42191 bytes --]

[-- Attachment #3: riscv-alloc_tag-error --]
[-- Type: text/plain, Size: 3328 bytes --]

In file included from ././include/linux/compiler_types.h:151,
                 from <command-line>:
./include/linux/alloc_tag.h: In function ‘__alloc_tag_ref_set’:
./include/asm-generic/percpu.h:31:40: error: implicit declaration of function ‘raw_smp_processor_id’ [-Wimplicit-function-declaration]
   31 | #define __my_cpu_offset per_cpu_offset(raw_smp_processor_id())
      |                                        ^~~~~~~~~~~~~~~~~~~~
./include/linux/compiler-gcc.h:35:33: note: in definition of macro ‘RELOC_HIDE’
   35 |         (typeof(ptr)) (__ptr + (off));                                  \
      |                                 ^~~
./include/asm-generic/percpu.h:44:31: note: in expansion of macro ‘SHIFT_PERCPU_PTR’
   44 | #define arch_raw_cpu_ptr(ptr) SHIFT_PERCPU_PTR(ptr, __my_cpu_offset)
      |                               ^~~~~~~~~~~~~~~~
./include/asm-generic/percpu.h:31:25: note: in expansion of macro ‘per_cpu_offset’
   31 | #define __my_cpu_offset per_cpu_offset(raw_smp_processor_id())
      |                         ^~~~~~~~~~~~~~
./include/asm-generic/percpu.h:44:53: note: in expansion of macro ‘__my_cpu_offset’
   44 | #define arch_raw_cpu_ptr(ptr) SHIFT_PERCPU_PTR(ptr, __my_cpu_offset)
      |                                                     ^~~~~~~~~~~~~~~
./include/linux/percpu-defs.h:242:9: note: in expansion of macro ‘arch_raw_cpu_ptr’
  242 |         arch_raw_cpu_ptr(ptr);                                          \
      |         ^~~~~~~~~~~~~~~~
./include/asm-generic/percpu.h:72:10: note: in expansion of macro ‘raw_cpu_ptr’
   72 |         *raw_cpu_ptr(&(pcp)) op val;                                    \
      |          ^~~~~~~~~~~
./include/asm-generic/percpu.h:156:9: note: in expansion of macro ‘raw_cpu_generic_to_op’
  156 |         raw_cpu_generic_to_op(pcp, val, op);                            \
      |         ^~~~~~~~~~~~~~~~~~~~~
./include/asm-generic/percpu.h:401:41: note: in expansion of macro ‘this_cpu_generic_to_op’
  401 | #define this_cpu_add_1(pcp, val)        this_cpu_generic_to_op(pcp, val, +=)
      |                                         ^~~~~~~~~~~~~~~~~~~~~~
./include/linux/percpu-defs.h:365:25: note: in expansion of macro ‘this_cpu_add_1’
  365 |                 case 1: stem##1(variable, __VA_ARGS__);break;           \
      |                         ^~~~
./include/linux/percpu-defs.h:491:41: note: in expansion of macro ‘__pcpu_size_call’
  491 | #define this_cpu_add(pcp, val)          __pcpu_size_call(this_cpu_add_, pcp, val)
      |                                         ^~~~~~~~~~~~~~~~
./include/linux/percpu-defs.h:501:41: note: in expansion of macro ‘this_cpu_add’
  501 | #define this_cpu_inc(pcp)               this_cpu_add(pcp, 1)
      |                                         ^~~~~~~~~~~~
./include/linux/alloc_tag.h:146:9: note: in expansion of macro ‘this_cpu_inc’
  146 |         this_cpu_inc(tag->counters->calls);
      |         ^~~~~~~~~~~~
make[4]: *** [scripts/Makefile.build:244: arch/riscv/kernel/irq.o] Error 1
make[3]: *** [scripts/Makefile.build:485: arch/riscv/kernel] Error 2
make[2]: *** [scripts/Makefile.build:485: arch/riscv] Error 2
make[1]: *** [/home/klara/git/linux/Makefile:1919: .] Error 2
make: *** [Makefile:240: __sub-make] Error 2

  reply	other threads:[~2024-04-07 16:51 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-05 13:54 [PATCH v6 13/37] lib: add allocation tagging support for memory allocation profiling Klara Modin
2024-04-06 21:47 ` Kent Overstreet
2024-04-07 13:44   ` Klara Modin
2024-04-07 16:50     ` Klara Modin [this message]
  -- strict thread matches above, loose matches on Subject: below --
2024-03-21 16:36 [PATCH v6 00/37] Memory " Suren Baghdasaryan
2024-03-21 16:36 ` [PATCH v6 13/37] lib: add allocation tagging support for memory " Suren Baghdasaryan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=2200255e-4db5-4a45-a032-c2bc02617caa@gmail.com \
    --to=klarasmodin@gmail.com \
    --cc=42.hyeyoo@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=aliceryhl@google.com \
    --cc=andreyknvl@gmail.com \
    --cc=arnd@arndb.de \
    --cc=axboe@kernel.dk \
    --cc=bristot@redhat.com \
    --cc=bsegall@google.com \
    --cc=catalin.marinas@arm.com \
    --cc=cgroups@vger.kernel.org \
    --cc=cl@linux.com \
    --cc=corbet@lwn.net \
    --cc=dave.hansen@linux.intel.com \
    --cc=dave@stgolabs.net \
    --cc=david@redhat.com \
    --cc=dennis@kernel.org \
    --cc=dhowells@redhat.com \
    --cc=dietmar.eggemann@arm.com \
    --cc=dvyukov@google.com \
    --cc=ebiggers@google.com \
    --cc=elver@google.com \
    --cc=glider@google.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=hannes@cmpxchg.org \
    --cc=hughd@google.com \
    --cc=iamjoonsoo.kim@lge.com \
    --cc=iommu@lists.linux.dev \
    --cc=jbaron@akamai.com \
    --cc=jhubbard@nvidia.com \
    --cc=juri.lelli@redhat.com \
    --cc=kaleshsingh@google.com \
    --cc=kasan-dev@googlegroups.com \
    --cc=keescook@chromium.org \
    --cc=kent.overstreet@linux.dev \
    --cc=kernel-team@android.com \
    --cc=liam.howlett@oracle.com \
    --cc=linux-arch@vger.kernel.org \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=linux-modules@vger.kernel.org \
    --cc=masahiroy@kernel.org \
    --cc=mcgrof@kernel.org \
    --cc=mgorman@suse.de \
    --cc=mhocko@suse.com \
    --cc=minchan@google.com \
    --cc=mingo@redhat.com \
    --cc=muchun.song@linux.dev \
    --cc=nathan@kernel.org \
    --cc=ndesaulniers@google.com \
    --cc=pasha.tatashin@soleen.com \
    --cc=paulmck@kernel.org \
    --cc=penberg@kernel.org \
    --cc=penguin-kernel@i-love.sakura.ne.jp \
    --cc=peterx@redhat.com \
    --cc=peterz@infradead.org \
    --cc=rientjes@google.com \
    --cc=roman.gushchin@linux.dev \
    --cc=rostedt@goodmis.org \
    --cc=rppt@kernel.org \
    --cc=songmuchun@bytedance.com \
    --cc=surenb@google.com \
    --cc=tglx@linutronix.de \
    --cc=tj@kernel.org \
    --cc=vbabka@suse.cz \
    --cc=vincent.guittot@linaro.org \
    --cc=void@manifault.com \
    --cc=vschneid@redhat.com \
    --cc=vvvvvv@google.com \
    --cc=will@kernel.org \
    --cc=willy@infradead.org \
    --cc=x86@kernel.org \
    --cc=yosryahmed@google.com \
    --cc=ytcoode@gmail.com \
    --cc=yuzhao@google.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).