From patchwork Tue Dec 18 08:24:08 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anshuman Khandual X-Patchwork-Id: 10735107 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 20C0914E2 for ; Tue, 18 Dec 2018 08:24:22 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 112612A5F0 for ; Tue, 18 Dec 2018 08:24:22 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0525C2A643; Tue, 18 Dec 2018 08:24:22 +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 DDADD2A5F0 for ; Tue, 18 Dec 2018 08:24:20 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id CB1F38E0007; Tue, 18 Dec 2018 03:24:18 -0500 (EST) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id C3CBA8E0001; Tue, 18 Dec 2018 03:24:18 -0500 (EST) 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 A939E8E0007; Tue, 18 Dec 2018 03:24:18 -0500 (EST) 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 7B73C8E0001 for ; Tue, 18 Dec 2018 03:24:18 -0500 (EST) Received: by mail-oi1-f198.google.com with SMTP id r82so941816oie.14 for ; Tue, 18 Dec 2018 00:24:18 -0800 (PST) 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=EdWy3L98kjLuKz23TRsdSnkAJ6GJGnEU9rbkwmKHh+8=; b=G2iT25KlIYkxkBod0I05s+KljNJCIfW0JIjyi4Pi/JhNbJJG20hYaFaIykrUn7gmzU vnekYRUzy5iWyAyHURYXvJWKwDte35w7Wj+nOVQ+GNi5FbC6bzc1v4BNR059DCtW6Omg dxG4sdpiIHU3ZoBzv0e/EoZLGqWYS7YwN+ninYtGx2QY08XTZHoNRtSnRrT6pGdgvdSx 3ZTm596U3EFnvwxd5Pf9ibFvxZtKeSnDwQ3JYuZPHc/xNoT41oessRII92nu4SKS/UHM r3gGQHqW+7/HDQERn7vlHWk8Gc2Qz61361minSj9g/agyOxdIW5ppaw6S1EhiGb8de8/ 35Rg== 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: AA+aEWZYaIKYYV2/8lsQG5h/27r2wM7G5T8Q0vesaTQPKCZpSdNg50ai +t4EtbiRmrDCXUxi2kIuIl8eHFql/1Q+GWMg1tLEy2uww1kG2/cMXfPRagnSsIwMVfJxhM/u7EW 5pP5BMaCsW5UhjuuLKvf3HtoiPF+0J6XVLmFFVhKa/O3neD1DGFA8j1ctrrNGjSyQXQ== X-Received: by 2002:aca:ce86:: with SMTP id e128mr7647754oig.247.1545121458269; Tue, 18 Dec 2018 00:24:18 -0800 (PST) X-Google-Smtp-Source: AFSGD/X5w662Wzb40LADifooV9deG1Yes74zDueTTLC3sFSMVEROpGYDxoQP6rt64VlbTA5x29VC X-Received: by 2002:aca:ce86:: with SMTP id e128mr7647730oig.247.1545121457547; Tue, 18 Dec 2018 00:24:17 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1545121457; cv=none; d=google.com; s=arc-20160816; b=lAmo+I15uSvUsQ5jk6TbHjfFQaya+7Fvyf+lA+eQtRTonIxulbqrr/TzztxLYaNyNe yGTNGVGeqZpuw3CoQGf5xcOljXZzwgJy3Frb1BKRD1KLLGPDabgVnfENVc+8eYWd1OKl IN7samt4RiF/p2bpRqHYDGEQLT6t3+RQtyBwkRj0QMGqkb9rUS/sICx40H3Ly7WK2+tC 2rp+rT83P9aQiMrs6gO+Ma+yeA9NHgLLKFU9kcOngcY8zKW92M4LjI7psytKDzXnP7w6 qxVh3Lzsta29IOWhrpk7byhph0sdtvnW79YF7d8o9GDGhYjJOavL2b7gCPWbmLmi9H+i /LCw== 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=EdWy3L98kjLuKz23TRsdSnkAJ6GJGnEU9rbkwmKHh+8=; b=VuuxtaO0iFg3eXUVvojEqruXyDWDhmi6qo9W2MdiuemaQMVcgaAEg4YocxGoh7XGcU W9GGMgufRSiu3ihGxZ93VyepPfJYMIFIxv6nWaBViV5uWn9VSYMydU9/+yicygtZ8QN2 ZiXtH9nNPLfMJbFzlOVlzGUqZKbcqXXoHT4CBswTCNRm1tBXMgQh0baNhYOllmV46f+A JfnBIKn88erCtnNzAzjUC8XoN2v5kr4SWa/2ev1TneFV+FkqSdM0yc4fzZiu5rE1yZ4M TFCSorStEpF22gzXIZmrDi1UblyMcYi8ZxNe7m8V5SsyaDBzbet/m1lPVNjg2KejLCo5 TkYQ== 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 z88si6727421ota.151.2018.12.18.00.24.17 for ; Tue, 18 Dec 2018 00:24:17 -0800 (PST) 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 EDB631650; Tue, 18 Dec 2018 00:24:16 -0800 (PST) Received: from p8cg001049571a15.blr.arm.com (p8cg001049571a15.blr.arm.com [10.162.41.146]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 6D4F53F575; Tue, 18 Dec 2018 00:24:13 -0800 (PST) From: Anshuman Khandual To: linux-mm@kvack.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Cc: suzuki.poulose@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: [RESEND PATCH V3 3/5] mm/hugetlb: Enable arch specific huge page size support for migration Date: Tue, 18 Dec 2018 13:54:08 +0530 Message-Id: <1545121450-1663-4-git-send-email-anshuman.khandual@arm.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1545121450-1663-1-git-send-email-anshuman.khandual@arm.com> References: <1545121450-1663-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 Reviewed-by: Steve Capper Acked-by: Michal Hocko 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 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); } /*