[Devel] [PATCH RHEL7 COMMIT] tcache: Fix __tcache_reclaim_page() wrong return value conversion

Konstantin Khorenko khorenko at virtuozzo.com
Fri Aug 11 16:42:50 MSK 2017


The commit is pushed to "branch-rh7-3.10.0-514.26.1.vz7.35.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh7-3.10.0-514.26.1.vz7.35.3
------>
commit 1258681447209dc4ec4ecdcc01eba25fef4ddb78
Author: Kirill Tkhai <ktkhai at virtuozzo.com>
Date:   Fri Aug 11 17:42:50 2017 +0400

    tcache: Fix __tcache_reclaim_page() wrong return value conversion
    
    Function tcache_page_tree_delete() returns pointer to struct page.
    We can't convert it to variable of bool type "as is", because they
    have different sizes. As all of struct pages are in kernel memory,
    their addresses are above PAGE_OFFSET, i.e. 0xffff880000000000.
    When such number is converted to bool, it becomes always 0. So,
    the algorhythm does not work as expected. Fix that.
    
    Fixes: ba2ea161f25b "mm/tcache: use lockless lookups in tcache's page tree"
    Signed-off-by: Kirill Tkhai <ktkhai at virtuozzo.com>
---
 mm/tcache.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/mm/tcache.c b/mm/tcache.c
index 458d3c4..0835e29 100644
--- a/mm/tcache.c
+++ b/mm/tcache.c
@@ -1059,12 +1059,11 @@ tcache_lru_isolate(int nid, struct page **pages, int nr_to_isolate)
 static bool __tcache_reclaim_page(struct page *page)
 {
 	struct tcache_node *node;
-	bool ret;
 
 	node = tcache_page_node(page);
-	ret = tcache_page_tree_delete(node, page->index, page);
+	page = tcache_page_tree_delete(node, page->index, page);
 	tcache_put_node_and_pool(node);
-	return ret;
+	return (page != NULL);
 }
 
 static int tcache_reclaim_pages(struct page **pages, int nr)


More information about the Devel mailing list