From patchwork Fri Sep 16 12:10:34 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Kirill A . Shutemov" X-Patchwork-Id: 9335631 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 D6B9C60839 for ; Fri, 16 Sep 2016 12:11:13 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C843B29F6E for ; Fri, 16 Sep 2016 12:11:13 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id BD03529F74; Fri, 16 Sep 2016 12:11:13 +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 92B1729F6E for ; Fri, 16 Sep 2016 12:11:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934775AbcIPMKt (ORCPT ); Fri, 16 Sep 2016 08:10:49 -0400 Received: from mga11.intel.com ([192.55.52.93]:35643 "EHLO mga11.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934676AbcIPMKl (ORCPT ); Fri, 16 Sep 2016 08:10:41 -0400 Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga102.fm.intel.com with ESMTP; 16 Sep 2016 05:10:39 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.30,344,1470726000"; d="scan'208";a="761941610" Received: from unknown (HELO black.fi.intel.com) ([10.237.72.56]) by FMSMGA003.fm.intel.com with ESMTP; 16 Sep 2016 05:10:35 -0700 Received: by black.fi.intel.com (Postfix, from userid 1000) id 5AFD110D; Fri, 16 Sep 2016 15:10:34 +0300 (EEST) Date: Fri, 16 Sep 2016 15:10:34 +0300 From: "Kirill A. Shutemov" To: Theodore Ts'o , Andreas Dilger , Jan Kara , Andrew Morton Cc: Alexander Viro , Hugh Dickins , Andrea Arcangeli , Dave Hansen , Vlastimil Babka , Matthew Wilcox , Ross Zwisler , linux-ext4@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, linux-block@vger.kernel.org Subject: Re: [PATCHv3 29/41] ext4: make ext4_mpage_readpages() hugepage-aware Message-ID: <20160916121034.GC72667@black.fi.intel.com> References: <20160915115523.29737-1-kirill.shutemov@linux.intel.com> <20160915115523.29737-30-kirill.shutemov@linux.intel.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20160915115523.29737-30-kirill.shutemov@linux.intel.com> User-Agent: Mutt/1.5.23.1 (2014-03-12) Sender: linux-fsdevel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP On Thu, Sep 15, 2016 at 02:55:11PM +0300, Kirill A. Shutemov wrote: > This patch modifies ext4_mpage_readpages() to deal with huge pages. > > We read out 2M at once, so we have to alloc (HPAGE_PMD_NR * > blocks_per_page) sector_t for that. I'm not entirely happy with kmalloc > in this codepath, but don't see any other option. > > Signed-off-by: Kirill A. Shutemov 0-DAY reported this: compiler: powerpc64-linux-gnu-gcc (Debian 5.4.0-6) 5.4.0 20160609 reproduce: wget https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross -O ~/bin/make.cro +ss chmod +x ~/bin/make.cross git checkout d8bfe8f327288810a9a099b15f3c89a834d419a4 # save the attached .config to linux build tree make.cross ARCH=powerpc All errors (new ones prefixed by >>): In file included from include/linux/linkage.h:4:0, from include/linux/kernel.h:6, from fs/ext4/readpage.c:30: fs/ext4/readpage.c: In function 'ext4_mpage_readpages': >> include/linux/compiler.h:491:38: error: call to '__compiletime_assert_144' declared with attribute error: +BUILD_BUG_ON failed: BIO_MAX_PAGES < HPAGE_PMD_NR _compiletime_assert(condition, msg, __compiletime_assert_, __LINE__) ^ include/linux/compiler.h:474:4: note: in definition of macro '__compiletime_assert' prefix ## suffix(); \ ^ include/linux/compiler.h:491:2: note: in expansion of macro '_compiletime_assert' _compiletime_assert(condition, msg, __compiletime_assert_, __LINE__) ^ include/linux/bug.h:51:37: note: in expansion of macro 'compiletime_assert' #define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg) ^ include/linux/bug.h:75:2: note: in expansion of macro 'BUILD_BUG_ON_MSG' BUILD_BUG_ON_MSG(condition, "BUILD_BUG_ON failed: " #condition) ^ fs/ext4/readpage.c:144:4: note: in expansion of macro 'BUILD_BUG_ON' BUILD_BUG_ON(BIO_MAX_PAGES < HPAGE_PMD_NR); ^ The fixup: diff --git a/fs/ext4/readpage.c b/fs/ext4/readpage.c index 6d7cbddceeb2..75b2a7700c9a 100644 --- a/fs/ext4/readpage.c +++ b/fs/ext4/readpage.c @@ -140,7 +140,8 @@ int ext4_mpage_readpages(struct address_space *mapping, block_in_file = (sector_t)page->index << (PAGE_SHIFT - blkbits); - if (PageTransHuge(page)) { + if (PageTransHuge(page) && + IS_ENABLED(TRANSPARENT_HUGE_PAGECACHE)) { BUILD_BUG_ON(BIO_MAX_PAGES < HPAGE_PMD_NR); nr = HPAGE_PMD_NR * blocks_per_page; /* XXX: need a better solution ? */