Messages in this thread | | | Date | Wed, 10 Sep 2014 10:10:00 +0200 | From | Peter Zijlstra <> | Subject | Re: [PATCH v4 2/2] ksm: provide support to use deferrable timers for scanner thread |
| |
On Tue, Sep 09, 2014 at 01:14:50PM -0700, Hugh Dickins wrote: > On Mon, 8 Sep 2014, Peter Zijlstra wrote: > > > switch_mm(oldmm, mm, next); > > > + wake_ksm = ksm_switch(mm); > > > > Is this the right mm? > > It's next->mm, that's the one I intended (though the patch might > be equally workable using prev->mm instead: given free rein, I'd > have opted for hooking into both prev and next, but free rein is > definitely not what should be granted around here!). > > > We've just switched the stack, > > I thought that came in switch_to() a few lines further down, > but don't think it matters for this.
Ah, yes. Got my task and mm separation messed up.
> > so we're looing at next->mm when we switched away from current. > > That might not exist anymore. > > I fail to see how that can be. Looking at the x86 switch_mm(), > I can see it referencing (unsurprisingly!) both old and new mms > at this point, and no reference to an mm is dropped before the > ksm_switch(). oldmm (there called mm) is mmdropped later in > finish_task_switch().
Well, see the above confusion about switch_mm vs switch_to :-/
So if this were switch_to(), we'd see next->mm as before the last context switch. And since that switch fully happened, it would also already have done the finish_task_switch() -> mmdrop().
[unhandled content-type:application/pgp-signature] | |