From: Thomas Gleixner <tglx@linutronix.de>
To: "Leizhen (ThunderTown)" <thunder.leizhen@huawei.com>,
Andrew Morton <akpm@linux-foundation.org>,
linux-kernel@vger.kernel.org, David Gow <davidgow@google.com>,
linux-kselftest@vger.kernel.org, kunit-dev@googlegroups.com
Subject: Re: [PATCH 3/3] debugobjects: Use hlist_cut_number() to optimize performance and improve readability
Date: Wed, 11 Sep 2024 10:54:41 +0200 [thread overview]
Message-ID: <878qvya7u6.ffs@tglx> (raw)
In-Reply-To: <85a8aa26-f135-fdde-fadf-c2b38a563805@huawei.com>
On Wed, Sep 11 2024 at 15:44, Leizhen wrote:
> On 2024/9/10 19:44, Thomas Gleixner wrote:
>> That minimizes the pool lock contention and the cache foot print. The
>> global to free pool must have an extra twist to accomodate non-batch
>> sized drops and to handle the all slots are full case, but that's just a
>> trivial detail.
>
> That's great. I really admire you for completing the refactor in such a
> short of time.
The trick is to look at it from the data model and not from the
code. You need to sit down and think about which data model is required
to achieve what you want. So the goal was batching, right?
That made it clear that the global pools need to be stacks of batches
and never handle single objects because that makes it complex. As a
consequence the per cpu pool is the one which does single object
alloc/free and then either gets a full batch from the global pool or
drops one into it. The rest is just mechanical.
> But I have a few minor comments.
> 1. When kmem_cache_zalloc() is called to allocate objs for filling,
> if less than one batch of objs are allocated, all of them can be
> pushed to the local CPU. That's, call pcpu_free() one by one.
If that's the case then we should actually immediately give them back
because thats a sign of memory pressure.
> 2. Member tot_cnt of struct global_pool can be deleted. We can get it
> simply and quickly through (slot_idx * ODEBUG_BATCH_SIZE). Avoid
> redundant maintenance.
Agreed.
> 3. debug_objects_pool_min_level also needs to be adjusted accordingly,
> the number of batches of the min level.
Sure. There are certainly more problems with that code. As I said, it's
untested and way to big to be reviewed. I'll split it up into more
manageable bits and pieces.
Thanks,
tglx
next prev parent reply other threads:[~2024-09-11 8:54 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-09-04 13:41 [PATCH 0/3] debugobjects: Add hlist_cut_number() and use it to optimize code Zhen Lei
2024-09-04 13:41 ` [PATCH 1/3] list: add hlist_cut_number() Zhen Lei
2024-09-04 13:41 ` [PATCH 2/3] list: test: Add a test for hlist_cut_number() Zhen Lei
2024-09-07 6:49 ` David Gow
2024-09-04 13:41 ` [PATCH 3/3] debugobjects: Use hlist_cut_number() to optimize performance and improve readability Zhen Lei
2024-09-09 18:41 ` Thomas Gleixner
2024-09-10 4:00 ` Leizhen (ThunderTown)
2024-09-10 11:44 ` Thomas Gleixner
2024-09-11 7:44 ` Leizhen (ThunderTown)
2024-09-11 8:54 ` Thomas Gleixner [this message]
2024-09-11 9:38 ` Leizhen (ThunderTown)
2024-10-07 12:22 ` Thomas Gleixner
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=878qvya7u6.ffs@tglx \
--to=tglx@linutronix.de \
--cc=akpm@linux-foundation.org \
--cc=davidgow@google.com \
--cc=kunit-dev@googlegroups.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=thunder.leizhen@huawei.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