Skip to contentSkip to conversation

remove unused code from do_wp_page

PATCH In review [email protected] 2 participants 2 messages Dec 11, 2012

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 remove unused code from do_wp_page

From: Dominik Dingel <[email protected]>

page_mkwrite is initalized with zero and only set once, from that point exists no way to get to the oom or oom_free_new labels.

---
 mm/memory.c | 4 ----
 1 file changed, 4 deletions(-)
mm/memory.c +0 -4
index 221fc9f..c322708 100644
@@ -2795,10 +2795,6 @@ oom_free_new:
 	page_cache_release(new_page);
 oom:
 	if (old_page) {
-		if (page_mkwrite) {
-			unlock_page(old_page);
-			page_cache_release(old_page);
-		}
 		page_cache_release(old_page);
 	}
 	return VM_FAULT_OOM;
Signature · 7 lines
1.7.12.4

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to [email protected].  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
maintainer
#1 lore raw
Quoted 14 lines · On Tue, 11 Dec 2012 15:44:50 +0100 [email protected] wrote:

From: Dominik Dingel <[email protected]>

page_mkwrite is initalized with zero and only set once, from that point exists no way to get to the oom or oom_free_new labels.

---
 mm/memory.c | 4 ----
 1 file changed, 4 deletions(-)
mm/memory.c +0 -0
index 221fc9f..c322708 100644

mm/memory.c oom_free_new: · line 2800

Quoted 10 lines
mm/memory.c +0 -4
@@ -2795,10 +2795,6 @@ oom_free_new:
 	page_cache_release(new_page);
 oom:
 	if (old_page) {
-		if (page_mkwrite) {
-			unlock_page(old_page);
-			page_cache_release(old_page);
-		}
 		page_cache_release(old_page);
 	}
 	return VM_FAULT_OOM;

I hope you've checked all this carefully, including the "goto reuse" and "goto gotten" paths. I *think* it's OK, but geeze. And the oom path surely gets very little testing.

do_wp_page() has become truly awful. I'm wondering if we should actually leave that code in there in case something changes in the future and it becomes necessary.

With my compiler version this patch actually increases the size of memory.o's text by 7 bytes. Odd.

Ho hum. You should also have done this:

mm/memory.c renamed from mm/memory.c~mm-memoryc-remove-unused-code-from-do_wp_page-fix +1 -2
@@ -2780,9 +2780,8 @@ unlock:
 oom_free_new:
 	page_cache_release(new_page);
 oom:
-	if (old_page) {
+	if (old_page)
 		page_cache_release(old_page);
-	}
 	return VM_FAULT_OOM;
 
 unwritable_page:

_

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>