Re: [RFC PATCH v3 1/2] membarrier: Provide register expedited private command
From: Boqun Feng
Date: Fri Sep 22 2017 - 04:57:49 EST
On Fri, Sep 22, 2017 at 10:24:41AM +0200, Peter Zijlstra wrote:
> On Fri, Sep 22, 2017 at 11:22:06AM +0800, Boqun Feng wrote:
> > The idea is in membarrier_private_expedited(), we go through all ->curr
> > on each CPU and
> > 1) If it's a userspace task and its ->mm is matched, we send an ipi
> > 2) If it's a kernel task, we skip
> > (Because there will be a smp_mb() implied by mmdrop(), when it
> > switchs to userspace task).
> > 3) If it's a userspace task and its ->mm is not matched, we take
> > the corresponding rq->lock and check rq->curr again, if its ->mm
> > matched, we send an ipi, otherwise we do nothing.
> > (Because if we observe rq->curr is not matched with rq->lock
> > held, when a task having matched ->mm schedules in, the rq->lock
> > pairing along with the smp_mb__after_spinlock() will guarantee
> > it observes all memory ops before sys_membarrir()).
> 3) is an insta DoS.
OK, fair enough.
Description: PGP signature