From: "Liam R. Howlett" <Liam.Howlett@oracle.com>
To: Sidhartha Kumar <sidhartha.kumar@oracle.com>
Cc: linux-kernel@vger.kernel.org, maple-tree@lists.infradead.org,
linux-mm@kvack.org, akpm@linux-foundation.org,
richard.weiyang@gmail.com
Subject: Re: [PATCH v2 1/6] maple_tree: convert mas_prealloc_calc() to take in a maple write state
Date: Tue, 25 Feb 2025 10:40:41 -0500 [thread overview]
Message-ID: <fp7vgt5zvqkjrg34aqztpvhywraqua2bzr5hs7h4adsm3jiu52@kier4m2xkqva> (raw)
In-Reply-To: <20250221163610.578409-2-sidhartha.kumar@oracle.com>
* Sidhartha Kumar <sidhartha.kumar@oracle.com> [250221 11:36]:
> In a subsequent patch, mas_prealloc_calc() will need to access fields only
> in the ma_wr_state. Convert the function to take in a ma_wr_state and
> modify all callers. There is no functional change.
>
> Signed-off-by: Sidhartha Kumar <sidhartha.kumar@oracle.com>
Reviewed-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
> ---
> lib/maple_tree.c | 16 ++++++++--------
> 1 file changed, 8 insertions(+), 8 deletions(-)
>
> diff --git a/lib/maple_tree.c b/lib/maple_tree.c
> index 42c65974a56c..0410e13a099e 100644
> --- a/lib/maple_tree.c
> +++ b/lib/maple_tree.c
> @@ -4144,13 +4144,14 @@ static inline void mas_wr_prealloc_setup(struct ma_wr_state *wr_mas)
> /**
> * mas_prealloc_calc() - Calculate number of nodes needed for a
> * given store oepration
> - * @mas: The maple state
> + * @wr_mas: The maple write state
> * @entry: The entry to store into the tree
> *
> * Return: Number of nodes required for preallocation.
> */
> -static inline int mas_prealloc_calc(struct ma_state *mas, void *entry)
> +static inline int mas_prealloc_calc(struct ma_wr_state *wr_mas, void *entry)
> {
> + struct ma_state *mas = wr_mas->mas;
> int ret = mas_mt_height(mas) * 3 + 1;
>
> switch (mas->store_type) {
> @@ -4247,16 +4248,15 @@ static inline enum store_type mas_wr_store_type(struct ma_wr_state *wr_mas)
> */
> static inline void mas_wr_preallocate(struct ma_wr_state *wr_mas, void *entry)
> {
> - struct ma_state *mas = wr_mas->mas;
> int request;
>
> mas_wr_prealloc_setup(wr_mas);
> - mas->store_type = mas_wr_store_type(wr_mas);
> - request = mas_prealloc_calc(mas, entry);
> + wr_mas->mas->store_type = mas_wr_store_type(wr_mas);
> + request = mas_prealloc_calc(wr_mas, entry);
> if (!request)
> return;
>
> - mas_node_count(mas, request);
> + mas_node_count(wr_mas->mas, request);
> }
>
> /**
> @@ -5401,7 +5401,7 @@ void *mas_store(struct ma_state *mas, void *entry)
> return wr_mas.content;
> }
>
> - request = mas_prealloc_calc(mas, entry);
> + request = mas_prealloc_calc(&wr_mas, entry);
> if (!request)
> goto store;
>
> @@ -5498,7 +5498,7 @@ int mas_preallocate(struct ma_state *mas, void *entry, gfp_t gfp)
>
> mas_wr_prealloc_setup(&wr_mas);
> mas->store_type = mas_wr_store_type(&wr_mas);
> - request = mas_prealloc_calc(mas, entry);
> + request = mas_prealloc_calc(&wr_mas, entry);
> if (!request)
> return ret;
>
> --
> 2.43.0
>
next prev parent reply other threads:[~2025-02-25 15:40 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-02-21 16:36 [PATCH v2 0/6] Track node vacancy to reduce worst case allocation counts Sidhartha Kumar
2025-02-21 16:36 ` [PATCH v2 1/6] maple_tree: convert mas_prealloc_calc() to take in a maple write state Sidhartha Kumar
2025-02-25 15:40 ` Liam R. Howlett [this message]
2025-02-21 16:36 ` [PATCH v2 2/6] maple_tree: use height and depth consistently Sidhartha Kumar
2025-02-25 15:39 ` Liam R. Howlett
2025-02-21 16:36 ` [PATCH v2 3/6] maple_tree: use vacant nodes to reduce worst case allocations Sidhartha Kumar
2025-02-25 15:46 ` Liam R. Howlett
2025-02-25 16:22 ` Sidhartha Kumar
2025-02-26 15:30 ` Liam R. Howlett
2025-02-21 16:36 ` [PATCH v2 4/6] maple_tree: break on convergence in mas_spanning_rebalance() Sidhartha Kumar
2025-02-25 15:47 ` Liam R. Howlett
2025-02-21 16:36 ` [PATCH v2 5/6] maple_tree: add sufficient height Sidhartha Kumar
2025-02-25 16:02 ` Liam R. Howlett
2025-02-25 20:36 ` Sidhartha Kumar
2025-02-26 15:15 ` Liam R. Howlett
2025-02-21 16:36 ` [PATCH v2 6/6] maple_tree: reorder mas->store_type case statements Sidhartha Kumar
2025-02-25 16:03 ` Liam R. Howlett
2025-02-25 15:40 ` [PATCH v2 0/6] Track node vacancy to reduce worst case allocation counts Liam R. Howlett
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=fp7vgt5zvqkjrg34aqztpvhywraqua2bzr5hs7h4adsm3jiu52@kier4m2xkqva \
--to=liam.howlett@oracle.com \
--cc=akpm@linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=maple-tree@lists.infradead.org \
--cc=richard.weiyang@gmail.com \
--cc=sidhartha.kumar@oracle.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