diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2019-07-12 04:03:14 -0400 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2019-07-16 16:02:39 -0400 |
commit | 30fe7b07f6cb7f391181eb9d2ea2687cd9bcf395 (patch) | |
tree | 850f2f651e97b32ef9b98a5fa637b8464821dac1 | |
parent | 45b2fda3d82d686cc014e4c485332f85e4bd64de (diff) |
dma-buf: Relax the write-seqlock for reallocating the shared fence list
As the set of shared fences is not being changed during reallocation of
the reservation list, we can skip updating the write_seqlock.
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
Cc: Christian König <christian.koenig@amd.com>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: https://patchwork.freedesktop.org/patch/msgid/20190712080314.21018-2-chris@chris-wilson.co.uk
-rw-r--r-- | drivers/dma-buf/reservation.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/drivers/dma-buf/reservation.c b/drivers/dma-buf/reservation.c index 80ecc1283d15..c71b85c8c159 100644 --- a/drivers/dma-buf/reservation.c +++ b/drivers/dma-buf/reservation.c | |||
@@ -157,15 +157,15 @@ int reservation_object_reserve_shared(struct reservation_object *obj, | |||
157 | (ksize(new) - offsetof(typeof(*new), shared)) / | 157 | (ksize(new) - offsetof(typeof(*new), shared)) / |
158 | sizeof(*new->shared); | 158 | sizeof(*new->shared); |
159 | 159 | ||
160 | preempt_disable(); | ||
161 | write_seqcount_begin(&obj->seq); | ||
162 | /* | 160 | /* |
163 | * RCU_INIT_POINTER can be used here, | 161 | * We are not changing the effective set of fences here so can |
164 | * seqcount provides the necessary barriers | 162 | * merely update the pointer to the new array; both existing |
163 | * readers and new readers will see exactly the same set of | ||
164 | * active (unsignaled) shared fences. Individual fences and the | ||
165 | * old array are protected by RCU and so will not vanish under | ||
166 | * the gaze of the rcu_read_lock() readers. | ||
165 | */ | 167 | */ |
166 | RCU_INIT_POINTER(obj->fence, new); | 168 | rcu_assign_pointer(obj->fence, new); |
167 | write_seqcount_end(&obj->seq); | ||
168 | preempt_enable(); | ||
169 | 169 | ||
170 | if (!old) | 170 | if (!old) |
171 | return 0; | 171 | return 0; |