[RFC/PATCH 1/7] ARM: ARM11 MPCore: pgd_alloc is not preempt safe

George G. Davis gdavis at mvista.com
Thu Oct 6 15:38:31 EDT 2011


On Oct 6, 2011, at 12:35 PM, Russell King - ARM Linux wrote:

> On Thu, Oct 06, 2011 at 01:08:28AM -0400, gdavis at mvista.com wrote:
>> @@ -31,6 +32,9 @@ pgd_t *pgd_alloc(struct mm_struct *mm)
>> 	if (!new_pgd)
>> 		goto no_pgd;
>> 
>> +	if (cache_ops_need_broadcast())
>> +		get_cpu();
> 
> Is there something wrong with preempt_disable() here and preempt_enable()
> below?

I used the {get,put}_cpu() variants merely to (try to) make it clear that we want
this region to be non-preemptible for the current CPU.

>  If it's preempt that we're concerned about, these are the correct
> interfaces to be used.

Since  {get,put}_cpu() are wrappers for preempt_{enable,disable}, it works
either way and I'm happy to just use preempt_{enable,disable} instead.  It
achieves the same goal with slightly less overhead.  Also, while we're on
the subject of preempt_enable, an earlier version of this change used
preempt_enable_no_resched() but I chose to avoid the no_reched flavor
since I felt that it was worth minimizing scheduler latencies.

I'll change all of the  {get,put}_cpu() variants to  preempt_{enable,disable}
and submit an updated series.

Thanks!

--
Regards,
George


>> +
>> 	memset(new_pgd, 0, USER_PTRS_PER_PGD * sizeof(pgd_t));
>> 
>> 	/*
>> @@ -42,6 +46,9 @@ pgd_t *pgd_alloc(struct mm_struct *mm)
>> 
>> 	clean_dcache_area(new_pgd, PTRS_PER_PGD * sizeof(pgd_t));
>> 
>> +	if (cache_ops_need_broadcast())
>> +		put_cpu();
>> +




More information about the linux-arm-kernel mailing list