lkml.org 
[lkml]   [2021]   [Feb]   [1]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [RFC 08/20] mm: store completed TLB generation
On Sat, Jan 30, 2021 at 04:11:20PM -0800, Nadav Amit wrote:
> +static inline void tlb_update_generation(atomic64_t *gen, u64 new_gen)
> +{
> + u64 cur_gen = atomic64_read(gen);
> +
> + while (cur_gen < new_gen) {
> + u64 old_gen = atomic64_cmpxchg(gen, cur_gen, new_gen);
> +
> + /* Check if we succeeded in the cmpxchg */
> + if (likely(cur_gen == old_gen))
> + break;
> +
> + cur_gen = old_gen;
> + };
> +}

u64 cur_gen = atomic64_read(gen);
while (cur_gen < new_gen && !atomic64_try_cmpxchg(gen, &cur_gen, new_gen))
;

\
 
 \ /
  Last update: 2021-02-01 12:54    [W:0.287 / U:0.072 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site