From patchwork Tue Oct 23 13:01:59 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anshuman Khandual X-Patchwork-Id: 10653193 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 0B77714DE for ; Tue, 23 Oct 2018 13:02:50 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E57A0295FA for ; Tue, 23 Oct 2018 13:02:49 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D61542963B; Tue, 23 Oct 2018 13:02:49 +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 5531F295FA for ; Tue, 23 Oct 2018 13:02:49 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id ED1046B0269; Tue, 23 Oct 2018 09:02:47 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id E81D36B026A; Tue, 23 Oct 2018 09:02:47 -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 D73166B026B; Tue, 23 Oct 2018 09:02:47 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-ot1-f69.google.com (mail-ot1-f69.google.com [209.85.210.69]) by kanga.kvack.org (Postfix) with ESMTP id A4A326B0269 for ; Tue, 23 Oct 2018 09:02:47 -0400 (EDT) Received: by mail-ot1-f69.google.com with SMTP id s2so690425ote.13 for ; Tue, 23 Oct 2018 06:02:47 -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=4iuEEaBISaII7FzdNAdnyV7b2VZSxJxNP7noDa63okc=; b=pL4IrkW9OFGIw/YzQso/nz1jf4YCIF602GOv1KuE8iLwgPjyIh6e3I2velRwPLSCCQ 6gYhyB5dxMYo5DZ2pliZRld3h8FUC4aMGI3WTwfqjV4MegK1EXSNMl2u2jbk8Zmt3Y9M i4RSSRkhrg6fZzx0Sk48HdV2xAzL5lc9CwUz8S34ogFGaXHSGt59CQ5swkvnSnMxAMHa W2k0phcoxBSCcAuBSLNDkPd9mg9CE2JX2zXzwSVzXQ5TDoXHoeeWbE0KAQABoiTNEIOd f77K3X9k3CGHXcK2WDgEq8lMjE6SUG5DqK4jGzD6owL1fK1XzRjo3yA48686/jEf0WvX Gv8Q== 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: ABuFfohB1gLccVkRtn8GCqmvQ2jkzQ6kq/5NDDG5MjEwtKKj9BipVLsL 8o740efIxKU00x5/uyDZTGTlSH5/4p1p1qz32F0XaJo6CBgkFfEB8ZJH3OufLCTDtakLS6ssh9/ x00Ct1B3mWZKzK03HdW1eS1SGK582VTswQg8bgg38KsvMFzPiwUB+Il+5oxgAodXNIg== X-Received: by 2002:aca:641:: with SMTP id 62-v6mr25290386oig.268.1540299767405; Tue, 23 Oct 2018 06:02:47 -0700 (PDT) X-Google-Smtp-Source: ACcGV63oofnzVio8NuRma/HYCJp+5NUSFun9l0uE70L4EsebyZMMkmcBqQ1S3FPJwMjnWCl3hlaL X-Received: by 2002:aca:641:: with SMTP id 62-v6mr25290289oig.268.1540299765100; Tue, 23 Oct 2018 06:02:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1540299765; cv=none; d=google.com; s=arc-20160816; b=gMTU+1IS2zYGVA6Z1iTtP/vVGiJBRWDZ/MaQa7K7UqdXgUifvQ/0KWtDcG43LSkY99 LMruHIKx0L9Q5tuAk52ECbflHzzXhhyuhwFX8dgRVmwDsSAvAISX+e426GWNBdB0xsUb 7rmtg6fqZiLD8Z91GGdFxCFmyf1FVFe72bE9TqHSIlHX4tGPRk02FnhaU8WObFv8Sog0 aUI/CSUovz4Q84I/Qr/8EQctP76rPL5x1ZiFgzRXI8P70ffFPlx2hPsIO/k+9j0j0utK v4jhjxsughaVLJfkY/HQGmI6HYpNnp9LyzgqKuD12rz7nGOY6mqAc1oDwCdvm0lbhfTn 7WNQ== 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=4iuEEaBISaII7FzdNAdnyV7b2VZSxJxNP7noDa63okc=; b=PqcLRw3/+sVJqXzBa6AcBTLDrZVMSWiM3bf/AeFMDytq2qjZfDc9gSyAhu1IBzohh6 j73J3yEykWDaerValr8Uy0qpGGomRQ3290mVkOzkeu8bY1BdaWf0VogpQM+48Skp+P84 lewZem+MKW4VspeUyW9qjN+YTb+sjZKfqHokN9R/vXbvsKXbj/pLXPcyjaeWZqfqoY+r WIHs4p9oWZdeVlxKXYh7inPosFOdv3nQKINlrgDvc5RaVG79MH4+9QQFoKlvYBDJqJij IXRVM3yYfoCoXpbqqFlxImouju+EBeB0IFB/Ftc8g2y1hhBS5Q2cRJR5nevsau1KYIYz 2N1A== 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 (usa-sjc-mx-foss1.foss.arm.com. [217.140.101.70]) by mx.google.com with ESMTP id q185-v6si546810oia.57.2018.10.23.06.02.44 for ; Tue, 23 Oct 2018 06:02:45 -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 092FC15BE; Tue, 23 Oct 2018 06:02:44 -0700 (PDT) Received: from p8cg001049571a15.arm.com (unknown [10.163.1.17]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id C86B13F6A8; Tue, 23 Oct 2018 06:02:37 -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, steve.capper@arm.com, catalin.marinas@arm.com, mhocko@kernel.org, akpm@linux-foundation.org, mike.kravetz@oracle.com, n-horiguchi@ah.jp.nec.com Subject: [PATCH V3 3/5] mm/hugetlb: Enable arch specific huge page size support for migration Date: Tue, 23 Oct 2018 18:31:59 +0530 Message-Id: <1540299721-26484-4-git-send-email-anshuman.khandual@arm.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1540299721-26484-1-git-send-email-anshuman.khandual@arm.com> References: <1540299721-26484-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. Reviewed-by: Naoya Horiguchi Signed-off-by: Anshuman Khandual Acked-by: Michal Hocko Reviewed-by: Steve Capper --- 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 70bcd89..4cc3871 100644 --- a/include/linux/hugetlb.h +++ b/include/linux/hugetlb.h @@ -493,18 +493,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); } /*