On Fri, 15 Oct 2010, KAMEZAWA Hiroyuki wrote: > But above is called all under pte_offset_map_lock(). > get_page_unless_zero() #1 is not necessary because we do all under a > pte_offset_map_lock(). The two (ptl and refcount) are entirely different. The ptl is for protecting the page table. The refcount handles only the page. However, if the entry in the page table is pointing to the page then there must have been a refcount taken on the page. So if you know that the page is in the page table and you took the ptl then you can be sure that the page refcount will not become zero. Therefore get_page_unless_zero() will never fail and there is no need to take additional refcounts as long as the page table lock is held and the page is not removed from the page table. > Index: mmotm-1013/mm/vmscan.c > =================================================================== > --- mmotm-1013.orig/mm/vmscan.c > +++ mmotm-1013/mm/vmscan.c > @@ -1166,7 +1166,8 @@ static unsigned long clear_active_flags( > * found will be decremented. > * > * Restrictions: > - * (1) Must be called with an elevated refcount on the page. This is a > + * (1) Must be called with an elevated refcount on the page, IOW, the > + * caller must guarantee that there is a stable reference. This is a > * fundamentnal difference from isolate_lru_pages (which is called > * without a stable reference). > * (2) the lru_lock must not be held. There is no need for this change since you have an elevated refcount. IMH The words "stable reference" may be confusing since the refcount may change. The elevated refcount protects against the freeing of the page. -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@xxxxxxxxxx For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"dont@xxxxxxxxx"> email@xxxxxxxxx </a>