[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Zn3UaMouBYYIMQr_@slm.duckdns.org>
Date: Thu, 27 Jun 2024 11:06:48 -1000
From: Tejun Heo <tj@...nel.org>
To: Xavier <xavier_qy@....com>
Cc: longman@...hat.com, mkoutny@...e.com, lizefan.x@...edance.com,
hannes@...xchg.org, cgroups@...r.kernel.org,
linux-kernel@...r.kernel.org, torvalds@...ux-foundation.org,
akpm@...ux-foundation.org
Subject: Re: [PATCH-cpuset v7 0/2] Add Union-Find and use it to optimize
cpuset
Hello, Xavier.
On Sun, Jun 23, 2024 at 10:38:59AM +0800, Xavier wrote:
> I think I understand your point now. I have modified the Union-Find
> implementation so that the allocation and deallocation are handled by the
> user, providing only the initialization interface. Thanks for your
> suggestion.
I recommend spending more time studying the existing data structures. The
pattern is pretty universal. The element is often embedded in a containing
structure. Macros and init methods are provided to initialize the element
along with operations which implement the data structure operations, and
then we use container_of() to obtain the embedding structure. We very rarely
allocate data structure members by themselves.
Also, the cleanup in cpuset seems nice but, if you can think of other use
cases, that'd be great too.
Thanks.
--
tejun
Powered by blists - more mailing lists