From patchwork Tue Oct 2 12:15:29 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anshuman Khandual X-Patchwork-Id: 10623575 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 9480016B1 for ; Tue, 2 Oct 2018 12:15:53 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8DDED28884 for ; Tue, 2 Oct 2018 12:15:53 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 81A6F28887; Tue, 2 Oct 2018 12:15:53 +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=-2.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 67EF628884 for ; Tue, 2 Oct 2018 12:15:52 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 598776B000C; Tue, 2 Oct 2018 08:15:51 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 549406B000D; Tue, 2 Oct 2018 08:15:51 -0400 (EDT) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 437066B000E; Tue, 2 Oct 2018 08:15:51 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-oi1-f198.google.com (mail-oi1-f198.google.com [209.85.167.198]) by kanga.kvack.org (Postfix) with ESMTP id 17FE16B000C for ; Tue, 2 Oct 2018 08:15:51 -0400 (EDT) Received: by mail-oi1-f198.google.com with SMTP id v188-v6so1112614oie.3 for ; Tue, 02 Oct 2018 05:15:51 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-original-authentication-results:x-gm-message-state:from:to:cc :subject:date:message-id:in-reply-to:references; bh=rYM/eYUmzWQBanp3WVF1aTtwbUrq2J/5yHr0Kx2HYlU=; b=W+Nt+4V/0EQ5bkFY9y4R8yY4Z/BKAoyQClJgRd9SGLRKFTrkG7j4Il3e/ShlCvaD87 EhEsD554zJ5HueOhyAsbj2pScFGAoYOLRPZLnPKzY0FtOccbZMODBFIXvLIqToGQLuSm StN4L+6Ge3UrySzPsklykYUBiNvp/6VG35nYyq7iSZoqYobtyI2j1iDOrgWrlbIT/soj dvoEgX3uPsIdG6Le3NA9+DvQ5U+/7a8rvobcbX8ent/lQuD+SZJ1zW//Sry0I1JaJZd7 dE7iRJUVikOJBrVCjlp3bwkKmwa6ZlAygm3o0DRV/EImGwBuC6w/363SnnMY0D8Lipqv 0BZg== X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of anshuman.khandual@arm.com designates 217.140.101.70 as permitted sender) smtp.mailfrom=anshuman.khandual@arm.com X-Gm-Message-State: ABuFfoiUKIoJA0EpA/qgRCfzBj4i9nPgggXJr0vZ5QAxQxOvlNF9VMys UxDzr3V9EFDSHvbWrFxSzFwxZB8vTsvfH97FIqgzKDpJsKpN2EH8attwkN7rJINOeRlPiPVo3bO ikjt911SWS2mfidZ5N8h36YviGNKAzbEiiE1HmBMyp21BJ/PoWtXpabNksGlDeHmjbg== X-Received: by 2002:a9d:4a14:: with SMTP id h20-v6mr8915393otf.160.1538482550874; Tue, 02 Oct 2018 05:15:50 -0700 (PDT) X-Google-Smtp-Source: ACcGV62Y4GqJz+++Nvf85zyoKRAWuc+M1PCw94EcZJBhXcYEEVAWtLbvDUjCSjvuWVXoTlWDj1Kc X-Received: by 2002:a9d:4a14:: with SMTP id h20-v6mr8915362otf.160.1538482550211; Tue, 02 Oct 2018 05:15:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1538482550; cv=none; d=google.com; s=arc-20160816; b=1Diokuub9/lBwXSffsROnlsB3wv7jVECbd/Mk0xm3FqscI/WmQ1tnMNa/8yr3aagpJ qOSflFznLYKoNpzkASuRNs2n1axg6xxrcwUaM2IxgAUSt2HGIjC8iR5q5RiYi3bdQWYx TaVSIpIZSeXzpOqXJSqTAQEERz381SFgLrRYAdxKmDN8OohKSz+X8bbI4yuwc+Z0meba EA9YbtdEXdgODMBwu0XJd1KAQtdnjtnHAoQLrYqbwEGa897DRelNx6/aWJP15wD/aQNq Kj+alK2H8mAiI8shsAz6YoRMxuOj67/a5U7MJuoIdOgiXGLwEpKUFD62Or8S/5T0gEIU pmTA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=references:in-reply-to:message-id:date:subject:cc:to:from; bh=rYM/eYUmzWQBanp3WVF1aTtwbUrq2J/5yHr0Kx2HYlU=; b=lbTq6rOBL5vCCHjd3gSIKUPpRY1KlDhMpIhCCb/RWeZs+mNaoNHHSzRypZSzmGSA5d f8bjZI6K69Ikiaj/aJ1Nb/+UxU8ilJyy7nmDpc49kqULwCTqJuQ07hajQTYzVatkguPJ MYQHuVKYML6NIxXjSrXW/ZuALsWYgjeM2Bij1uVSHFakYopcVM4skoH47JJcfqVQfrdt r8+QzS6W7hLkdEgGgplabBxkHF3MktI5YntA+RKb7UI+ihm4lAKOY3iOcUNYx9DG/VF8 3RZWTg1Jha8UOsN9OZ9jJGzSZn6zeS9nbMZphhqCkqw7Oqmz57nNZRmJAS50TZjG3odG kQHw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of anshuman.khandual@arm.com designates 217.140.101.70 as permitted sender) smtp.mailfrom=anshuman.khandual@arm.com Received: from foss.arm.com (foss.arm.com. [217.140.101.70]) by mx.google.com with ESMTP id y56si2546102oty.7.2018.10.02.05.15.50 for ; Tue, 02 Oct 2018 05:15:50 -0700 (PDT) Received-SPF: pass (google.com: domain of anshuman.khandual@arm.com designates 217.140.101.70 as permitted sender) client-ip=217.140.101.70; Authentication-Results: mx.google.com; spf=pass (google.com: domain of anshuman.khandual@arm.com designates 217.140.101.70 as permitted sender) smtp.mailfrom=anshuman.khandual@arm.com Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id CA97615B2; Tue, 2 Oct 2018 05:15:49 -0700 (PDT) Received: from p8cg001049571a15.arm.com (unknown [10.163.1.117]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 2C4AD3F5B7; Tue, 2 Oct 2018 05:15:45 -0700 (PDT) From: Anshuman Khandual To: linux-mm@kvack.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Cc: suzuki.poulose@arm.com, punit.agrawal@arm.com, will.deacon@arm.com, Steven.Price@arm.com, catalin.marinas@arm.com, mhocko@kernel.org, mike.kravetz@oracle.com, n-horiguchi@ah.jp.nec.com Subject: [PATCH 2/4] mm/hugetlb: Enable arch specific huge page size support for migration Date: Tue, 2 Oct 2018 17:45:29 +0530 Message-Id: <1538482531-26883-3-git-send-email-anshuman.khandual@arm.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1538482531-26883-1-git-send-email-anshuman.khandual@arm.com> References: <1538482531-26883-1-git-send-email-anshuman.khandual@arm.com> X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: X-Virus-Scanned: ClamAV using ClamSMTP Architectures like arm64 have HugeTLB page sizes which are different than generic sizes at PMD, PUD, PGD level and implemented via contiguous bits. At present these special size HugeTLB pages cannot be identified through macros like (PMD|PUD|PGDIR)_SHIFT and hence chosen not be migrated. Enabling migration support for these special HugeTLB page sizes along with the generic ones (PMD|PUD|PGD) would require identifying all of them on a given platform. A platform specific hook can precisely enumerate all huge page sizes supported for migration. Instead of comparing against standard huge page orders let hugetlb_migration_support() function call a platform hook arch_hugetlb_migration_support(). Default definition for the platform hook maintains existing semantics which checks standard huge page order. But an architecture can choose to override the default and provide support for a comprehensive set of huge page sizes. Signed-off-by: Anshuman Khandual --- include/linux/hugetlb.h | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/include/linux/hugetlb.h b/include/linux/hugetlb.h index 9c1b77f..9df1d59 100644 --- a/include/linux/hugetlb.h +++ b/include/linux/hugetlb.h @@ -479,18 +479,29 @@ static inline pgoff_t basepage_index(struct page *page) extern int dissolve_free_huge_page(struct page *page); extern int dissolve_free_huge_pages(unsigned long start_pfn, unsigned long end_pfn); -static inline bool hugepage_migration_supported(struct hstate *h) -{ + #ifdef CONFIG_ARCH_ENABLE_HUGEPAGE_MIGRATION +#ifndef arch_hugetlb_migration_supported +static inline bool arch_hugetlb_migration_supported(struct hstate *h) +{ if ((huge_page_shift(h) == PMD_SHIFT) || (huge_page_shift(h) == PUD_SHIFT) || (huge_page_shift(h) == PGDIR_SHIFT)) return true; else return false; +} +#endif #else +static inline bool arch_hugetlb_migration_supported(struct hstate *h) +{ return false; +} #endif + +static inline bool hugepage_migration_supported(struct hstate *h) +{ + return arch_hugetlb_migration_supported(h); } static inline spinlock_t *huge_pte_lockptr(struct hstate *h,