[Patch] mm/ksm.c is doing an unneeded _notify in write_protect_page.

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

 



ksm.c's write_protect_page implements a lockless means of verifying a
page does not have any users of the page which are not accounted for via
other kernel tracking means.  It does this by removing the writable pte
with TLB flushes, checking the page_count against the total known users,
and then using set_pte_at_notify to make it a read-only entry.

An unneeded mmu_notifier callout is made in the case where the known
users does not match the page_count.  In that event, we are inserting
the identical pte and there is no need for the set_pte_at_notify, but
rather the simpler set_pte_at suffices.

Signed-off-by: Robin Holt <holt@xxxxxxx>
To: Izik Eidus <ieidus@xxxxxxxxxx>
Cc: Hugh Dickins <hugh.dickins@xxxxxxxxxxxxx>
Cc: Chris Wright <chrisw@xxxxxxxxxx>
Cc: linux-mm@xxxxxxxxx

---

 mm/ksm.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Index: ksm_remove_notify/mm/ksm.c
===================================================================
--- ksm_remove_notify.orig/mm/ksm.c	2010-03-11 09:24:30.000000000 -0600
+++ ksm_remove_notify/mm/ksm.c	2010-03-11 09:35:18.000000000 -0600
@@ -751,7 +751,7 @@ static int write_protect_page(struct vm_
 		 * page
 		 */
 		if (page_mapcount(page) + 1 + swapped != page_count(page)) {
-			set_pte_at_notify(mm, addr, ptep, entry);
+			set_pte_at(mm, addr, ptep, entry);
 			goto out_unlock;
 		}
 		entry = pte_wrprotect(entry);

--
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>

[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]