From: Boris Ostrovsky Subject: Re: [PATCH v3 4/9] mm: Scrub memory from idle loop Date: Fri, 12 May 2017 10:42:34 -0400 Message-ID: <71c26482-3e53-4091-fe57-58e18de5201e@oracle.com> References: <1492184258-3277-1-git-send-email-boris.ostrovsky@oracle.com> <1492184258-3277-5-git-send-email-boris.ostrovsky@oracle.com> <1494498375.7393.5.camel@citrix.com> <34644cef-567d-b558-c580-5ed7d8116fa5@oracle.com> <1494517737.7393.7.camel@citrix.com> <1494577036.7393.10.camel@citrix.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============5828795401264607730==" Return-path: In-Reply-To: <1494577036.7393.10.camel@citrix.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xen.org Sender: "Xen-devel" To: Dario Faggioli , xen-devel@lists.xen.org Cc: sstabellini@kernel.org, wei.liu2@citrix.com, George.Dunlap@eu.citrix.com, andrew.cooper3@citrix.com, ian.jackson@eu.citrix.com, tim@xen.org, jbeulich@suse.com List-Id: xen-devel@lists.xenproject.org This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --===============5828795401264607730== Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="AdCQWA5brw6dwpFeSAfFPoxJ4e7qO81mP" This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --AdCQWA5brw6dwpFeSAfFPoxJ4e7qO81mP Content-Type: multipart/mixed; boundary="17rXbTPikXvM3gLSdOf3V47gxGcmpSSDT"; protected-headers="v1" From: Boris Ostrovsky To: Dario Faggioli , xen-devel@lists.xen.org Cc: sstabellini@kernel.org, wei.liu2@citrix.com, George.Dunlap@eu.citrix.com, andrew.cooper3@citrix.com, ian.jackson@eu.citrix.com, tim@xen.org, jbeulich@suse.com Message-ID: <71c26482-3e53-4091-fe57-58e18de5201e@oracle.com> Subject: Re: [Xen-devel] [PATCH v3 4/9] mm: Scrub memory from idle loop References: <1492184258-3277-1-git-send-email-boris.ostrovsky@oracle.com> <1492184258-3277-5-git-send-email-boris.ostrovsky@oracle.com> <1494498375.7393.5.camel@citrix.com> <34644cef-567d-b558-c580-5ed7d8116fa5@oracle.com> <1494517737.7393.7.camel@citrix.com> <1494577036.7393.10.camel@citrix.com> In-Reply-To: <1494577036.7393.10.camel@citrix.com> --17rXbTPikXvM3gLSdOf3V47gxGcmpSSDT Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 05/12/2017 04:17 AM, Dario Faggioli wrote: > On Thu, 2017-05-11 at 13:05 -0400, Boris Ostrovsky wrote: >> On 05/11/2017 11:48 AM, Dario Faggioli wrote: >> >>> It probably would be at least a bit better, if scrub_free_pages() >>> would >>> check for softirqs() _before_ starting any scrubbing (which I don't >>> think it does, right now, am I right?). >> Right. >> >> I didn't realize that do_tasklet() also schedules softirq. So you are >> suggesting something along the lines of >> >> do_tasklet(); >> >> if ( !softirq_pending(smp_processor_id() && >> !scrub_free_pages() ) >> (*pm_idle)(); >> >> do_softirq(); >> > I was indeed suggesting something like that, and in fact I was about to= > say that, yes, what you wrote above should work. > > *But* (and sorry for overlooking that), if there is more than one > tasklet queued SCHEDULE_SOFTIRQ is not raised (look at the 'if > (list_empty())' in do_tasklet()), and hence the softirq_pending() check= > would fail, and we'll still try to scrub. > > Basically, we'd have some scrubbing happening in between the processing= > of two tasklets (and this will repeat, as a pattern, if there are more > than two), and unless someone else raises an (unrelated) softirq at > some point, we may even scrub a significant amount of memory. > > So, it looks to me that the gating should consider both, > softirq_pending() and tasklet_work_to_do (making it look really really > similar to cpu_is_haltable()...). So I will then just use cpu_is_haltable() --- the possibly unnecessary cpu_online() check here is simple/quick enough to justify reusing existing macro. -boris --17rXbTPikXvM3gLSdOf3V47gxGcmpSSDT-- --AdCQWA5brw6dwpFeSAfFPoxJ4e7qO81mP Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQIcBAEBCAAGBQJZFcnaAAoJEIredpCGysGySj0P/j9rNJDUVTy+i738M+LsD0YS dH2vqIa93oGUgOu0phSxguzHl0C0AcC6RpYRwhLv4etqaw1rywyV7L2iJGGYQY7M VXiJLYybBuHiD7aJUlKtC3G0tAhXDMA8Hce3nyWnKpjrEnUWWqF9dvnnUzu6fiZl tHffqFb/uEblTP2cQi27SYKOSKpx8K0DNxI4M74UM60D8jbA//yerOQUb4/8Ipgz XWmHcl7NHRjiNPbuMRyJMIT7mxYsdzaxNtB2yOMKj71yj+LgGwXbesV+91qm84u7 QE2G1I88HMDmtknElhz5Lb1dyFYyp5zIvQSNYP61hLXQteER4TMRlVYDbRr0gunV MQYqZFoynbZW+ksiI9p7xRmY3TeoFoVddkoYXl0oq8OFLpI7Pg+tYr3qYr77gg8N T9vE1aPLlScEok6SFmMC6mRqcHQlwF6H3YU8lGp+ci5sWOjcC6ubpL3kTiNZfdoT XGuSjO1Ea+rYE9KVTCAVCgBZkyXJHrA7aq7HmYSzlqqvokCpBDpRe3BvVJZywnJv joxkx/ouiLqNE3jNhErMzwFMM83xGLpG47XQSKyPiNwyy+PlyE4JoH7e09ApdyWM B3B9IKxpnthJm4bcoTt/ZLike9o18lUoYVedsVuahzKLkyN+XC8QSfLLJXC4T9CN QSou1FjGWX4I3dvUUgTb =6HAQ -----END PGP SIGNATURE----- --AdCQWA5brw6dwpFeSAfFPoxJ4e7qO81mP-- --===============5828795401264607730== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: base64 Content-Disposition: inline X19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX18KWGVuLWRldmVs IG1haWxpbmcgbGlzdApYZW4tZGV2ZWxAbGlzdHMueGVuLm9yZwpodHRwczovL2xpc3RzLnhlbi5v cmcveGVuLWRldmVsCg== --===============5828795401264607730==--