From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757183AbdEVCS2 (ORCPT ); Sun, 21 May 2017 22:18:28 -0400 Received: from mga14.intel.com ([192.55.52.115]:29644 "EHLO mga14.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756798AbdEVCS0 (ORCPT ); Sun, 21 May 2017 22:18:26 -0400 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.38,377,1491289200"; d="scan'208";a="90118315" From: "Huang, Ying" To: Andrew Morton Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, Huang Ying , Johannes Weiner , Minchan Kim Subject: [PATCH] mm, THP, swap: Check whether CONFIG_THP_SWAP enabled earlier Date: Mon, 22 May 2017 10:18:14 +0800 Message-Id: <20170522021814.17891-1-ying.huang@intel.com> X-Mailer: git-send-email 2.11.0 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Huang Ying This patch is only a code clean up patch without functionality changes. It moves CONFIG_THP_SWAP checking from inside swap slot allocation to before we start swapping the THP. This makes the code path a little easier to be followed and understood. Signed-off-by: "Huang, Ying" Cc: Johannes Weiner Cc: Minchan Kim --- mm/swap_slots.c | 3 +-- mm/vmscan.c | 3 ++- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/mm/swap_slots.c b/mm/swap_slots.c index 90c1032a8ac3..14c2a91289e5 100644 --- a/mm/swap_slots.c +++ b/mm/swap_slots.c @@ -310,8 +310,7 @@ swp_entry_t get_swap_page(struct page *page) entry.val = 0; if (PageTransHuge(page)) { - if (IS_ENABLED(CONFIG_THP_SWAP)) - get_swap_pages(1, true, &entry); + get_swap_pages(1, true, &entry); return entry; } diff --git a/mm/vmscan.c b/mm/vmscan.c index f7e949ac9756..90722afd4916 100644 --- a/mm/vmscan.c +++ b/mm/vmscan.c @@ -1134,7 +1134,8 @@ static unsigned long shrink_page_list(struct list_head *page_list, * away. Chances are some or all of the * tail pages can be freed without IO. */ - if (!compound_mapcount(page) && + if ((!IS_ENABLED(CONFIG_THP_SWAP) || + !compound_mapcount(page)) && split_huge_page_to_list(page, page_list)) goto activate_locked; } -- 2.11.0