From: "Leizhen (ThunderTown)" <thunder.leizhen@huawei.com>
To: Thomas Gleixner <tglx@linutronix.de>,
Andrew Morton <akpm@linux-foundation.org>,
<linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v2 4/6] debugobjects: Don't start fill if there are remaining nodes locally
Date: Tue, 10 Sep 2024 23:29:13 +0800 [thread overview]
Message-ID: <8bc3ebed-f092-6842-bd8b-a8b4b1b30cf1@huawei.com> (raw)
In-Reply-To: <32bd93ec-747f-b5a1-917f-f885b87600a5@huawei.com>
On 2024/9/9 21:51, Leizhen (ThunderTown) wrote:
> +static void fill_pool(void)
> +{
> + gfp_t gfp = __GFP_HIGH | __GFP_NOWARN;
> + static atomic_t cpus_allocating;
>
> if (unlikely(!obj_cache))
> return;
>
> + /*
> + * Avoid allocation and lock contention when
> + *
> + * - the CPU local pool has at least 2 objects left
> + * - another CPU is already in the allocation path
> + * - the global pool has not reached the critical level yet
> + */
> + if (this_cpu_read(percpu_obj_pool.obj_free) > 1 && atomic_read(&cpus_allocating) &&
I rethink that 'cpus_allocating' and 'percpu_obj_pool.obj_free > 1' should be
contradictory. We can only choose one of them. If 'cpus_allocating' can work,
there's no need for another. Since I had no way to prove that 'cpus_allocating'
would work, I removed it in V3.
> + READ_ONCE(obj_pool_free) > (debug_objects_pool_min_level / 2))
> + return;
> +
> + atomic_inc(&cpus_allocating);
> while (READ_ONCE(obj_pool_free) < debug_objects_pool_min_level) {
> struct debug_obj *new[ODEBUG_BATCH_SIZE];
> int cnt;
--
Regards,
Zhen Lei
next prev parent reply other threads:[~2024-09-10 15:29 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-09-04 13:39 [PATCH v2 0/6] debugobjects: Do some minor optimizations, fixes and cleaups Zhen Lei
2024-09-04 13:39 ` [PATCH v2 1/6] debugobjects: Fix the compilation attributes of some global variables Zhen Lei
2024-09-09 14:59 ` [tip: core/debugobjects] " tip-bot2 for Zhen Lei
2024-09-04 13:39 ` [PATCH v2 2/6] debugobjects: Fix the misuse of global variables in fill_pool() Zhen Lei
2024-09-09 14:59 ` [tip: core/debugobjects] debugobjects: Fix conditions " tip-bot2 for Zhen Lei
2024-09-04 13:39 ` [PATCH v2 3/6] debugobjects: Remove redundant checks " Zhen Lei
2024-09-09 14:59 ` [tip: core/debugobjects] " tip-bot2 for Zhen Lei
2024-09-04 13:39 ` [PATCH v2 4/6] debugobjects: Don't start fill if there are remaining nodes locally Zhen Lei
2024-09-05 3:11 ` Leizhen (ThunderTown)
2024-09-05 3:45 ` Leizhen (ThunderTown)
2024-09-05 7:04 ` Leizhen (ThunderTown)
2024-09-09 9:22 ` Thomas Gleixner
2024-09-09 11:03 ` Leizhen (ThunderTown)
2024-09-09 12:10 ` Thomas Gleixner
2024-09-09 13:51 ` Leizhen (ThunderTown)
2024-09-09 14:35 ` Thomas Gleixner
2024-09-09 14:41 ` Thomas Gleixner
2024-09-10 6:13 ` Leizhen (ThunderTown)
2024-09-10 15:29 ` Leizhen (ThunderTown) [this message]
2024-09-11 1:21 ` Leizhen (ThunderTown)
2024-09-04 13:39 ` [PATCH v2 5/6] debugobjects: Use hlist_splice_init() to reduce lock conflicts Zhen Lei
2024-09-04 13:39 ` [PATCH v2 6/6] debugobjects: Delete a piece of redundant code Zhen Lei
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=8bc3ebed-f092-6842-bd8b-a8b4b1b30cf1@huawei.com \
--to=thunder.leizhen@huawei.com \
--cc=akpm@linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=tglx@linutronix.de \
/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
all inboxes | Powered by JetHome®