Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753260AbbHCMEl (ORCPT ); Mon, 3 Aug 2015 08:04:41 -0400 Received: from relay.parallels.com ([195.214.232.42]:42516 "EHLO relay.parallels.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752968AbbHCMEj (ORCPT ); Mon, 3 Aug 2015 08:04:39 -0400 From: Vladimir Davydov To: Andrew Morton CC: Johannes Weiner , Michal Hocko , Minchan Kim , Rik van Riel , Mel Gorman , , Subject: [PATCH 1/3] mm: move workingset_activation under lru_lock Date: Mon, 3 Aug 2015 15:04:21 +0300 Message-ID: <9ddafcd3ee1f09962b7f570c3cf2237afefafba6.1438599199.git.vdavydov@parallels.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: References: MIME-Version: 1.0 Content-Type: text/plain X-ClientProxiedBy: US-EXCH2.sw.swsoft.com (10.255.249.46) To US-EXCH2.sw.swsoft.com (10.255.249.46) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1685 Lines: 47 The following patch will move inactive_age from zone to lruvec in order to make workingset detection logic memcg aware. To achieve that we need to be able to call mem_cgroup_page_lruvec() from all the workingset detection related functions. Currently, workingset_eviction() and workingset_refault() meet this requirement, because both of them are always called with the page isolated and locked, which prevents the page from being migrated to another cgroup. However, workingset_activation(), which is called from mark_page_accessed(), does not. To make this function safe to call mem_cgroup_page_lruvec(), this patch moves its invocation to __activate_page() called under the lru_lock. Signed-off-by: Vladimir Davydov --- mm/swap.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/mm/swap.c b/mm/swap.c index db43c9b4891d..f3569c8280be 100644 --- a/mm/swap.c +++ b/mm/swap.c @@ -514,6 +514,9 @@ static void __activate_page(struct page *page, struct lruvec *lruvec, __count_vm_event(PGACTIVATE); update_page_reclaim_stat(lruvec, file, 1); + + if (file) + workingset_activation(page); } } @@ -618,8 +621,6 @@ void mark_page_accessed(struct page *page) else __lru_cache_activate_page(page); ClearPageReferenced(page); - if (page_is_file_cache(page)) - workingset_activation(page); } else if (!PageReferenced(page)) { SetPageReferenced(page); } -- 2.1.4 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/