[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <alpine.DEB.2.21.1911121051490.1833@nanos.tec.linutronix.de>
Date: Tue, 12 Nov 2019 10:55:24 +0100 (CET)
From: Thomas Gleixner <tglx@...utronix.de>
To: Peter Zijlstra <peterz@...radead.org>
cc: LKML <linux-kernel@...r.kernel.org>, x86@...nel.org,
Linus Torvalds <torvalds@...uxfoundation.org>,
Andy Lutomirski <luto@...nel.org>,
Stephen Hemminger <stephen@...workplumber.org>,
Willy Tarreau <w@....eu>, Juergen Gross <jgross@...e.com>,
Sean Christopherson <sean.j.christopherson@...el.com>,
"H. Peter Anvin" <hpa@...or.com>,
Linus Torvalds <torvalds@...ux-foundation.org>
Subject: Re: [patch V2 08/16] x86/ioperm: Add bitmap sequence numberc
On Tue, 12 Nov 2019, Peter Zijlstra wrote:
> On Mon, Nov 11, 2019 at 11:03:22PM +0100, Thomas Gleixner wrote:
> > Add a globally unique sequence number which is incremented when ioperm() is
> > changing the I/O bitmap of a task. Store the new sequence number in the
> > io_bitmap structure and compare it along with the actual struct pointer
> > with the one which was last loaded on a CPU. Only update the bitmap if
> > either of the two changes. That should further reduce the overhead of I/O
> > bitmap scheduling when there are only a few I/O bitmap users on the system.
>
> > + /* Update the sequence number to force an update in switch_to() */
> > + iobm->sequence = atomic64_add_return(1, &io_bitmap_sequence);
>
> > + if (tss->last_bitmap != iobm ||
> > + tss->last_sequence != iobm->sequence)
> > + switch_to_update_io_bitmap(tss, iobm);
>
> Initially I wondered why we need a globally unique sequence number if we
> already check the struct iobitmap pointer. That ought to make the
> sequence number per-object.
>
> However, that breaks for memory re-use. So yes, we need that thing to be
> global.
Actually with a global 64bit wide counter we can just avoid the pointer
comparison. Assumed a ioperm() syscall every nanosecond it takes about 584
years of uptime to wrap around. :)
Thanks,
tglx
Powered by blists - more mailing lists