[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH v3 4/9] mm: Scrub memory from idle loop



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()...).

Regards,
Dario
-- 
<<This happens because I choose it to happen!>> (Raistlin Majere)
-----------------------------------------------------------------
Dario Faggioli, Ph.D, http://about.me/dario.faggioli
Senior Software Engineer, Citrix Systems R&D Ltd., Cambridge (UK)

Attachment: signature.asc
Description: This is a digitally signed message part

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
https://lists.xen.org/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.