mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-21 17:11:57 -06:00
qsp: Use WITH_RCU_READ_LOCK_GUARD
The automatic rcu read lock maintenance works quite nicely in this case where it previously relied on a comment to delimit the lifetime and now has a block. Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
This commit is contained in:
parent
b66173afbd
commit
2a86be2571
1 changed files with 10 additions and 12 deletions
|
@ -598,7 +598,6 @@ static void qsp_ht_delete(void *p, uint32_t h, void *htp)
|
|||
|
||||
static void qsp_mktree(GTree *tree, bool callsite_coalesce)
|
||||
{
|
||||
QSPSnapshot *snap;
|
||||
struct qht ht, coalesce_ht;
|
||||
struct qht *htp;
|
||||
|
||||
|
@ -610,8 +609,8 @@ static void qsp_mktree(GTree *tree, bool callsite_coalesce)
|
|||
* We must remain in an RCU read-side critical section until we're done
|
||||
* with the snapshot.
|
||||
*/
|
||||
rcu_read_lock();
|
||||
snap = atomic_rcu_read(&qsp_snapshot);
|
||||
WITH_RCU_READ_LOCK_GUARD() {
|
||||
QSPSnapshot *snap = atomic_rcu_read(&qsp_snapshot);
|
||||
|
||||
/* Aggregate all results from the global hash table into a local one */
|
||||
qht_init(&ht, qsp_entry_no_thread_cmp, QSP_INITIAL_SIZE,
|
||||
|
@ -622,8 +621,7 @@ static void qsp_mktree(GTree *tree, bool callsite_coalesce)
|
|||
if (snap) {
|
||||
qsp_diff(&snap->ht, &ht);
|
||||
}
|
||||
/* done with the snapshot; RCU can reclaim it */
|
||||
rcu_read_unlock();
|
||||
}
|
||||
|
||||
htp = &ht;
|
||||
if (callsite_coalesce) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue