Re: [PATCH 6/6] mm: add preempt points into __purge_vmap_area_lazy

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

 



On Tue, 18 Oct 2016 16:56:48 -0400
Steven Rostedt <rostedt@xxxxxxxxxxx> wrote:


> Is releasing the lock within a llist_for_each_entry_safe() actually safe? Is
> vmap_area_lock the one to protect the valist?
> 
> That is llist_for_each_entry_safe(va, n_va, valist, purg_list) does:
> 
> 	for (va = llist_entry(valist, typeof(*va), purge_list);
> 	     &va->purge_list != NULL &&
> 	     n_va = llist_entry(va->purge_list.next, typeof(*n_va),
> 				purge_list, true);
> 	     pos = n)
> 
> Thus n_va is pointing to the next element to process when we release the
> lock. Is it possible for another task to get into this same path and process
> the item that n_va is pointing to? Then when the preempted task comes back,
> grabs the vmap_area_lock, and then continues the loop with what n_va has,
> could that cause problems? That is, the next iteration after releasing the
> lock does va = n_va. What happens if n_va no longer exits?
> 
> I don't know this code that well, and perhaps vmap_area_lock is not protecting
> the list and this is all fine.
> 

Bah, nevermind. I missed the:

	valist = llist_del_all(&vmap_purge_list);

so yeah, all should be good.

Nothing to see here, move along please.

-- Steve
--
To unsubscribe from this list: send the line "unsubscribe linux-rt-users" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [RT Stable]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]

  Powered by Linux