[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1ed4c8f7.3e12.196adf621a2.Coremail.00107082@163.com>
Date: Thu, 8 May 2025 11:35:11 +0800 (CST)
From: "David Wang" <00107082@....com>
To: "Kent Overstreet" <kent.overstreet@...ux.dev>
Cc: "Suren Baghdasaryan" <surenb@...gle.com>, akpm@...ux-foundation.org,
linux-mm@...ck.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] alloc_tag: avoid mem alloc and iter reset when reading
allocinfo
At 2025-05-08 11:31:12, "Kent Overstreet" <kent.overstreet@...ux.dev> wrote:
>On Thu, May 08, 2025 at 11:06:35AM +0800, David Wang wrote:
>> Thanks for the feedback~
>> I agree that memory allocation normally dose not take major part of a profiling report,
>> even profiling a fio test, kmem_cache_alloc only takes ~1% perf samples.
>>
>> I don't know why I have this "the less memory allocation, the better' mindset, maybe
>> I was worrying about memory fragmentation, or something else I learned on some "textbook",
>> To be honest, I have never had real experience with those worries....
>
>It's a common bias. "Memory allocations" take up a lot of conceptual
>space in our heads, and generally for good reason - i.e. handling memory
>allocation errors is often a major concern, and you do always want to be
>aware of memory layout.
>
>But this can turn into an aversion that's entirely disproportionate -
>e.g. using linked linked lists and fixed size arrays in ways that are
>entirely inappropriate, instead of vectors and other better data
>structures; good data structures always require allocations.
>
>Profile, profile, profile, and remember your basic CS (big O notation) -
>90% of the time, simple code with good big O running time is all you
>need.
copy that~!
Thanks
David
Powered by blists - more mailing lists