Skip to contentSkip to conversation

staging: fwserial: Switch to kvfree_rcu() API

PATCH Superseded Shang XiaoJing 2 participants 6 messages Sep 17, 2022 – Sep 19, 2022 Staging

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 staging: fwserial: Switch to kvfree_rcu() API

Instead of invoking a synchronize_rcu() to free a pointer after a grace period, we can directly make use of new API that does the same but in more efficient way.

---
sorry, the previous same patch have the wrong v3 flag in subject.

---
 drivers/staging/fwserial/fwserial.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/staging/fwserial/fwserial.c +1 -2
index 81b06d88ed0d..ac2d625f0883 100644
@@ -2117,8 +2117,7 @@ static void fwserial_remove_peer(struct fwtty_peer *peer)
 	if (port)
 		fwserial_release_port(port, true);
 
-	synchronize_rcu();
-	kfree(peer);
+	kvfree_rcu(peer);
 }
 
 /**
Signature · 1 line
2.17.1
#1 lore raw
Quoted 3 lines · Shang XiaoJing

Instead of invoking a synchronize_rcu() to free a pointer after a grace period, we can directly make use of new API that does the same but in

a new

Quoted 1 line

more efficient way.

...

Quoted 1 line

sorry, the previous same patch have the wrong v3 flag in subject.

has

First of all, this brings even more confusion. Since the below needs some work, we want to have a v4 with a proper changelog, explaining also v1 and v3.

...

drivers/staging/fwserial/fwserial.c static void fwserial_remove_peer(struct fwtty_peer *peer) · line 2120

Quoted 3 lines
drivers/staging/fwserial/fwserial.c +1 -2
-       synchronize_rcu();
-       kfree(peer);
+       kvfree_rcu(peer);

This is not equivalent. The commit message doesn't explain why the "v" variant is needed. So, shouldn't it be the plain kfree_rcu()?

Signature · 2 lines
With Best Regards,
Andy Shevchenko
#2 lore raw
Quoted 6 lines · Andy Shevchenko
Quoted 2 lines · Shang XiaoJing

Instead of invoking a synchronize_rcu() to free a pointer after a grace period, we can directly make use of new API that does the same but in

a new

Quoted 1 line

more efficient way.

Quoted 8 lines

...

Quoted 1 line

sorry, the previous same patch have the wrong v3 flag in subject.

has

First of all, this brings even more confusion. Since the below needs some work, we want to have a v4 with a proper changelog, explaining also v1 and v3.

Ok, I 'll figure out a more clear changelog.

Besides, v3 is my miss, please ignore it, next patch will be v2.

Quoted 8 lines

...

drivers/staging/fwserial/fwserial.c static void fwserial_remove_peer(struct fwtty_peer *peer) · line 2120

Quoted 3 lines
drivers/staging/fwserial/fwserial.c +1 -2
-       synchronize_rcu();
-       kfree(peer);
+       kvfree_rcu(peer);

This is not equivalent. The commit message doesn't explain why the "v" variant is needed. So, shouldn't it be the plain kfree_rcu()?

kfree_rcu() is defined as kvfree_rcu(), which will free the pointer with the

corresponding way(use is_vmalloc_addr() to determine vfree or kfree). For

clearlity, kfree_rcu() is a better way, will be fixed in patch v2.

Thanks :-),

Shang XiaoJing

#3 lore raw
Quoted 2 lines · shangxiaojing
Quoted 1 line · Andy Shevchenko

On Sat, Sep 17, 2022 at 5:12 AM Shang XiaoJing <[email protected]> wrote:

...

Quoted 7 lines
Quoted 3 lines

First of all, this brings even more confusion. Since the below needs some work, we want to have a v4 with a proper changelog, explaining also v1 and v3.

Ok, I 'll figure out a more clear changelog.

Besides, v3 is my miss, please ignore it, next patch will be v2.

Versioning should go only one direction. You confuse people with your versioning schema.

Signature · 2 lines
With Best Regards,
Andy Shevchenko
#4 lore raw
Quoted 5 lines · Andy Shevchenko
Quoted 2 lines · shangxiaojing
Quoted 1 line · Andy Shevchenko

On Sat, Sep 17, 2022 at 5:12 AM Shang XiaoJing <[email protected]> wrote:

...

Quoted 8 lines
Quoted 6 lines
Quoted 3 lines

First of all, this brings even more confusion. Since the below needs some work, we want to have a v4 with a proper changelog, explaining also v1 and v3.

Ok, I 'll figure out a more clear changelog.

Besides, v3 is my miss, please ignore it, next patch will be v2.

Versioning should go only one direction. You confuse people with your versioning schema.

Should I send the sent patch "[PATCH -next v2] staging: fwserial: Switch to kfree_rcu() API" again as v4?

Thanks,

Shang XiaoJing

#5 lore raw
Quoted 4 lines · shangxiaojing
Quoted 3 lines · Andy Shevchenko
Quoted 2 lines · shangxiaojing
Quoted 1 line · Andy Shevchenko

On Sat, Sep 17, 2022 at 5:12 AM Shang XiaoJing <[email protected]> wrote:

...

Quoted 11 lines
Quoted 8 lines
Quoted 6 lines
Quoted 3 lines

First of all, this brings even more confusion. Since the below needs some work, we want to have a v4 with a proper changelog, explaining also v1 and v3.

Ok, I 'll figure out a more clear changelog.

Besides, v3 is my miss, please ignore it, next patch will be v2.

Versioning should go only one direction. You confuse people with your versioning schema.

Should I send the sent patch "[PATCH -next v2] staging: fwserial: Switch to kfree_rcu() API" again as v4?

Yes, and explain in the changelog all of the previous ones, like
v3: the first version of the patch
v1: v3 resent as v1
v2: changed kv... to k...
v4: resend as v4 to avoid versioning confusion

Signature · 2 lines
With Best Regards,
Andy Shevchenko