[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <YBfrZ+gBCTYFS995@hirez.programming.kicks-ass.net>
Date: Mon, 1 Feb 2021 12:52:07 +0100
From: Peter Zijlstra <peterz@...radead.org>
To: Nadav Amit <nadav.amit@...il.com>
Cc: linux-mm@...ck.org, linux-kernel@...r.kernel.org,
Nadav Amit <namit@...are.com>,
Andrea Arcangeli <aarcange@...hat.com>,
Andrew Morton <akpm@...ux-foundation.org>,
Andy Lutomirski <luto@...nel.org>,
Dave Hansen <dave.hansen@...ux.intel.com>,
Thomas Gleixner <tglx@...utronix.de>,
Will Deacon <will@...nel.org>, Yu Zhao <yuzhao@...gle.com>,
Nick Piggin <npiggin@...il.com>, x86@...nel.org
Subject: Re: [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))
;
Powered by blists - more mailing lists