* [PATCH v3] async: Let kfree() out of the critical area of the lock
@ 2019-11-19 3:26 Yunfeng Ye
2019-12-17 3:18 ` Yunfeng Ye
0 siblings, 1 reply; 2+ messages in thread
From: Yunfeng Ye @ 2019-11-19 3:26 UTC (permalink / raw)
To: Thomas Gleixner
Cc: gregkh, bvanassche, alexander.h.duyck, bhelgaas, sakari.ailus,
linux-kernel, hushiyuan, linfeilong
The async_lock is big global lock, and kfree() is not always cheap, it
will increase lock contention. it's better let kfree() outside the lock
to keep the critical area as short as possible.
Signed-off-by: Yunfeng Ye <yeyunfeng@huawei.com>
Reviewed-by: Alexander Duyck <alexander.h.duyck@linux.intel.com>
Reviewed-by: Bart Van Assche <bvanassche@acm.org>
---
v2 -> v3:
- move kfree() after wake_up(&async_done)
v1 -> v2:
- update the description
- add "Reviewed-by"
kernel/async.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/kernel/async.c b/kernel/async.c
index 4f9c1d614016..d2ab75e8b1ab 100644
--- a/kernel/async.c
+++ b/kernel/async.c
@@ -135,14 +135,14 @@ static void async_run_entry_fn(struct work_struct *work)
list_del_init(&entry->domain_list);
list_del_init(&entry->global_list);
- /* 3) free the entry */
- kfree(entry);
atomic_dec(&entry_count);
-
spin_unlock_irqrestore(&async_lock, flags);
- /* 4) wake up any waiters */
+ /* 3) wake up any waiters */
wake_up(&async_done);
+
+ /* 4) free the entry */
+ kfree(entry);
}
/**
--
2.7.4
^ permalink raw reply [flat|nested] 2+ messages in thread
* [PATCH v3] async: Let kfree() out of the critical area of the lock
2019-11-19 3:26 [PATCH v3] async: Let kfree() out of the critical area of the lock Yunfeng Ye
@ 2019-12-17 3:18 ` Yunfeng Ye
0 siblings, 0 replies; 2+ messages in thread
From: Yunfeng Ye @ 2019-12-17 3:18 UTC (permalink / raw)
To: Thomas Gleixner
Cc: gregkh, bvanassche, alexander.h.duyck, bhelgaas, sakari.ailus,
linux-kernel, hushiyuan, linfeilong
The async_lock is big global lock, and kfree() is not always cheap, it
will increase lock contention. it's better let kfree() outside the lock
to keep the critical area as short as possible.
Signed-off-by: Yunfeng Ye <yeyunfeng@huawei.com>
Reviewed-by: Alexander Duyck <alexander.h.duyck@linux.intel.com>
Reviewed-by: Bart Van Assche <bvanassche@acm.org>
---
v2 -> v3:
- move kfree() after wake_up(&async_done)
v1 -> v2:
- update the description
- add "Reviewed-by"
kernel/async.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/kernel/async.c b/kernel/async.c
index 4f9c1d614016..d2ab75e8b1ab 100644
--- a/kernel/async.c
+++ b/kernel/async.c
@@ -135,14 +135,14 @@ static void async_run_entry_fn(struct work_struct *work)
list_del_init(&entry->domain_list);
list_del_init(&entry->global_list);
- /* 3) free the entry */
- kfree(entry);
atomic_dec(&entry_count);
-
spin_unlock_irqrestore(&async_lock, flags);
- /* 4) wake up any waiters */
+ /* 3) wake up any waiters */
wake_up(&async_done);
+
+ /* 4) free the entry */
+ kfree(entry);
}
/**
--
2.7.4
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2019-12-17 3:19 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-11-19 3:26 [PATCH v3] async: Let kfree() out of the critical area of the lock Yunfeng Ye
2019-12-17 3:18 ` Yunfeng Ye
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®