From mboxrd@z Thu Jan 1 00:00:00 1970 From: Dario Faggioli Subject: Re: [PATCH v3 4/9] mm: Scrub memory from idle loop Date: Fri, 12 May 2017 10:17:16 +0200 Message-ID: <1494577036.7393.10.camel@citrix.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> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============8312724060657124521==" Return-path: In-Reply-To: List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xen.org Sender: "Xen-devel" To: Boris Ostrovsky , 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 --===============8312724060657124521== Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="=-HVX7HZfuuPHvCUnIx05k" --=-HVX7HZfuuPHvCUnIx05k Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable 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?). >=20 > Right. >=20 > I didn't realize that do_tasklet() also schedules softirq. So you are > suggesting something along the lines of >=20 > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0do_tasklet(); >=20 > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0if ( !softirq_pending(smp= _processor_id() && > !scrub_free_pages() ) > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0(= *pm_idle)(); >=20 > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0do_softirq(); >=20 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()...). Regards, Dario --=20 <> (Raistlin Majere) ----------------------------------------------------------------- Dario Faggioli, Ph.D, http://about.me/dario.faggioli Senior Software Engineer, Citrix Systems R&D Ltd., Cambridge (UK) --=-HVX7HZfuuPHvCUnIx05k Content-Type: application/pgp-signature; name="signature.asc" Content-Description: This is a digitally signed message part Content-Transfer-Encoding: 7bit -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQIcBAABCAAGBQJZFW+OAAoJEBZCeImluHPu5esP/icqqdfYbz7AqqRvr/1w/i0s Zc1RkXfGJ3m5sg8rlED7T3xOPfzcxCvwSMs3XHNfii3qNI4uoHujNBFo9JzSGTSt xkfpBbFqo4ZygQiZMg+7pJB+0KmvdlDxW48Q45AWGdJDNllLGhVJMQjSNDXTuoEb YXWm6xBzlELQ3otJBuwTFc5rVrvrKhkQ8kKl3n8vih6c4ARkeGO49uiAznbMNoDJ 03Ze1p2LsBqm4TPFMaFWH89ZeOno6+F5tJT/5BE1OMuUHyZ3jPkUTDqWD/7CfCRO 9yHfKSBauyt4kn+gOcgKI8LpjuS4WBtTmgiXtiVnEOqox+zwJvC5oaeG1PiKdkX/ N1DpHnTd9KWFPBb9n14a127E7Tu2c2qCuIAMSMyy0xGDxi9kpPDALft9L01A1nrh DzWevtWZu49IsMGgUSt2EhDOL2gDl7Iz4jSJGCzOM2bD7lxxn4uXqYmKHpTW+lLa 44YEZ2spWjDznnLnj0NMPlz7f0BzICnrgqseHpNwN8BJ31m9l/JtCaoxwuHmykmX TvaUOHKMkUPaDygcpON074HLTDfmp52an3/TNFqcnEEEj/UTk9KxcYiE1zY2k7Br wgOb7p6Iad3NG4WkC5MvAV0Ap1w7hvqXZL0lf4Pu4hthltHx/O0EBBgJk2MFL2ht YeOY7g+vYWZYILC2I+8W =VeLf -----END PGP SIGNATURE----- --=-HVX7HZfuuPHvCUnIx05k-- --===============8312724060657124521== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: base64 Content-Disposition: inline X19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX18KWGVuLWRldmVs IG1haWxpbmcgbGlzdApYZW4tZGV2ZWxAbGlzdHMueGVuLm9yZwpodHRwczovL2xpc3RzLnhlbi5v cmcveGVuLWRldmVsCg== --===============8312724060657124521==--