From: "David Wang" <00107082@163.com>
To: "Kent Overstreet" <kent.overstreet@linux.dev>
Cc: "Suren Baghdasaryan" <surenb@google.com>,
akpm@linux-foundation.org, linux-mm@kvack.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] alloc_tag: avoid mem alloc and iter reset when reading allocinfo
Date: Thu, 8 May 2025 11:35:11 +0800 (CST) [thread overview]
Message-ID: <1ed4c8f7.3e12.196adf621a2.Coremail.00107082@163.com> (raw)
In-Reply-To: <y6egptcxlbzgboykjorh3syxwy4wu37eolmjtwuwu36gtbfhgf@o3o34qii4gmq>
At 2025-05-08 11:31:12, "Kent Overstreet" <kent.overstreet@linux.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
next prev parent reply other threads:[~2025-05-08 3:35 UTC|newest]
Thread overview: 44+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-05-07 17:55 [PATCH] alloc_tag: avoid mem alloc and iter reset when reading allocinfo David Wang
2025-05-07 18:19 ` David Wang
2025-05-07 23:42 ` [PATCH] " Suren Baghdasaryan
2025-05-08 0:01 ` Kent Overstreet
2025-05-08 3:06 ` David Wang
2025-05-08 3:31 ` Kent Overstreet
2025-05-08 3:35 ` David Wang [this message]
2025-05-08 4:07 ` Kent Overstreet
2025-05-08 5:51 ` David Wang
2025-05-08 13:33 ` Kent Overstreet
2025-05-08 16:24 ` David Wang
2025-05-08 16:34 ` Kent Overstreet
2025-05-08 16:58 ` David Wang
2025-05-08 17:17 ` David Wang
2025-05-08 17:26 ` Kent Overstreet
2025-05-08 2:24 ` David Wang
2025-05-07 23:36 ` Suren Baghdasaryan
2025-05-08 3:10 ` David Wang
2025-05-08 15:32 ` David Wang
2025-05-08 21:41 ` Suren Baghdasaryan
2025-05-09 5:51 ` [PATCH 1/2] alloc_tag: add timestamp to codetag iterator David Wang
2025-05-09 16:10 ` Suren Baghdasaryan
2025-05-09 16:16 ` David Wang
2025-05-09 5:53 ` [PATCH 2/2] alloc_tag: keep codetag iterator cross read() calls David Wang
2025-05-09 17:34 ` Suren Baghdasaryan
2025-05-09 17:45 ` David Wang
2025-05-09 17:38 ` [PATCH v2 1/2] alloc_tag: add sequence number for module and iterator David Wang
2025-05-09 19:25 ` Suren Baghdasaryan
2025-06-09 6:42 ` [PATCH v3 " David Wang
2025-06-09 16:41 ` Suren Baghdasaryan
2025-05-09 17:39 ` [PATCH v2 2/2] alloc_tag: keep codetag iterator active between read() calls David Wang
2025-05-09 18:33 ` Tim Chen
2025-05-09 19:36 ` Suren Baghdasaryan
2025-05-09 19:46 ` Tim Chen
2025-05-09 20:46 ` Suren Baghdasaryan
2025-05-09 21:15 ` Suren Baghdasaryan
2025-05-10 3:10 ` David Wang
2025-05-10 3:30 ` Suren Baghdasaryan
2025-05-10 3:58 ` David Wang
2025-05-10 4:03 ` Suren Baghdasaryan
2025-06-09 6:44 ` [PATCH v3 2/2] alloc_tag: keep codetag iterator active between read() David Wang
2025-06-10 16:22 ` Suren Baghdasaryan
2025-05-10 3:35 ` [PATCH v2 2/2] alloc_tag: keep codetag iterator active between read() calls David Wang
2025-05-10 3:25 ` David Wang
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=1ed4c8f7.3e12.196adf621a2.Coremail.00107082@163.com \
--to=00107082@163.com \
--cc=akpm@linux-foundation.org \
--cc=kent.overstreet@linux.dev \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=surenb@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 NNTP newsgroup(s).