From patchwork Thu May 25 06:46:28 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Huang, Ying" X-Patchwork-Id: 9747823 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 0D9EF60246 for ; Thu, 25 May 2017 06:49:38 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id F15652785D for ; Thu, 25 May 2017 06:49:37 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E63C027E5A; Thu, 25 May 2017 06:49:37 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8F0502785D for ; Thu, 25 May 2017 06:49:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1034594AbdEYGtV (ORCPT ); Thu, 25 May 2017 02:49:21 -0400 Received: from mga06.intel.com ([134.134.136.31]:36317 "EHLO mga06.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1165288AbdEYGrD (ORCPT ); Thu, 25 May 2017 02:47:03 -0400 Received: from orsmga003.jf.intel.com ([10.7.209.27]) by orsmga104.jf.intel.com with ESMTP; 24 May 2017 23:47:02 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.38,390,1491289200"; d="scan'208";a="972848713" Received: from yhuang-dev.sh.intel.com ([10.239.13.12]) by orsmga003.jf.intel.com with ESMTP; 24 May 2017 23:47:00 -0700 From: "Huang, Ying" To: Andrew Morton Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, Huang Ying , Johannes Weiner , Minchan Kim , Jens Axboe , Ming Lei , Shaohua Li , linux-block@vger.kernel.org Subject: [PATCH -mm 06/13] block: Increase BIO_MAX_PAGES to PMD size if THP_SWAP enabled Date: Thu, 25 May 2017 14:46:28 +0800 Message-Id: <20170525064635.2832-7-ying.huang@intel.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170525064635.2832-1-ying.huang@intel.com> References: <20170525064635.2832-1-ying.huang@intel.com> Sender: linux-block-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Huang Ying In this patch, BIO_MAX_PAGES is changed from 256 to HPAGE_PMD_NR if CONFIG_THP_SWAP is enabled and HPAGE_PMD_NR > 256. This is to support THP (Transparent Huge Page) swap optimization. Where the THP will be write to disk as a whole instead of HPAGE_PMD_NR normal pages to batch the various operations during swap. And the page is likely to be written to disk to free memory when system memory goes really low, the memory pool need to be used to avoid deadlock. Signed-off-by: "Huang, Ying" Cc: Johannes Weiner Cc: Minchan Kim Cc: Jens Axboe Cc: Ming Lei Cc: Shaohua Li Cc: linux-block@vger.kernel.org --- include/linux/bio.h | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/include/linux/bio.h b/include/linux/bio.h index d1b04b0e99cf..314796486507 100644 --- a/include/linux/bio.h +++ b/include/linux/bio.h @@ -38,7 +38,15 @@ #define BIO_BUG_ON #endif +#ifdef CONFIG_THP_SWAP +#if HPAGE_PMD_NR > 256 +#define BIO_MAX_PAGES HPAGE_PMD_NR +#else #define BIO_MAX_PAGES 256 +#endif +#else +#define BIO_MAX_PAGES 256 +#endif #define bio_prio(bio) (bio)->bi_ioprio #define bio_set_prio(bio, prio) ((bio)->bi_ioprio = prio)