Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753237AbdGXFUJ (ORCPT ); Mon, 24 Jul 2017 01:20:09 -0400 Received: from mga04.intel.com ([192.55.52.120]:39184 "EHLO mga04.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752755AbdGXFSz (ORCPT ); Mon, 24 Jul 2017 01:18:55 -0400 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.40,405,1496127600"; d="scan'208";a="290458697" From: "Huang, Ying" To: Andrew Morton Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, Huang Ying , Johannes Weiner , Minchan Kim , Hugh Dickins , Shaohua Li , Rik van Riel Subject: [PATCH -mm -v3 04/12] mm, THP, swap: Don't allocate huge cluster for file backed swap device Date: Mon, 24 Jul 2017 13:18:32 +0800 Message-Id: <20170724051840.2309-5-ying.huang@intel.com> X-Mailer: git-send-email 2.13.2 In-Reply-To: <20170724051840.2309-1-ying.huang@intel.com> References: <20170724051840.2309-1-ying.huang@intel.com> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1163 Lines: 37 From: Huang Ying It's hard to write a whole transparent huge page (THP) to a file backed swap device during swapping out and the file backed swap device isn't very popular. So the huge cluster allocation for the file backed swap device is disabled. Signed-off-by: "Huang, Ying" Cc: Johannes Weiner Cc: Minchan Kim Cc: Hugh Dickins Cc: Shaohua Li Cc: Rik van Riel --- mm/swapfile.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/mm/swapfile.c b/mm/swapfile.c index b110faf3c82a..21cbdecbc19a 100644 --- a/mm/swapfile.c +++ b/mm/swapfile.c @@ -948,9 +948,10 @@ int get_swap_pages(int n_goal, bool cluster, swp_entry_t swp_entries[]) spin_unlock(&si->lock); goto nextsi; } - if (cluster) - n_ret = swap_alloc_cluster(si, swp_entries); - else + if (cluster) { + if (!(si->flags & SWP_FILE)) + n_ret = swap_alloc_cluster(si, swp_entries); + } else n_ret = scan_swap_map_slots(si, SWAP_HAS_CACHE, n_goal, swp_entries); spin_unlock(&si->lock); -- 2.13.2