From patchwork Tue Oct 23 13:02:01 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anshuman Khandual X-Patchwork-Id: 10653197 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 0278014DE for ; Tue, 23 Oct 2018 13:03:01 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DC8582962F for ; Tue, 23 Oct 2018 13:03:00 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D007729640; Tue, 23 Oct 2018 13:03:00 +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 639062962F for ; Tue, 23 Oct 2018 13:03:00 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 1DC0B6B026C; Tue, 23 Oct 2018 09:02:59 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 188AF6B026D; Tue, 23 Oct 2018 09:02:59 -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 078806B026E; Tue, 23 Oct 2018 09:02:59 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-oi1-f199.google.com (mail-oi1-f199.google.com [209.85.167.199]) by kanga.kvack.org (Postfix) with ESMTP id D14386B026C for ; Tue, 23 Oct 2018 09:02:58 -0400 (EDT) Received: by mail-oi1-f199.google.com with SMTP id y81-v6so689679oig.20 for ; Tue, 23 Oct 2018 06:02:58 -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=axeM6OthVDhoKCv9CcscX9D8Fz/UPJrVkNkh8VHmsuA=; b=choQo1tVy9VSjSLAhxkz/jWI5DRm4IfzqUl7LivW3K5yRMl9hoF7JnVqNmyjhQyZ14 tyhGC8wj8RPeEgIJecX3qIHQrqTT4+MCGZu4jWVnPUhsbV7Ul2Wl2ZjJeRDXcL/5JCdV 7FgCP8Ha6t68EoWEVO3dgMRuJW6ZyCnCnk+IP/wGzmN/tEyvFaUsDRVhbMjs0oY4r4q6 N1VzFA3/xxEXBoBJ9IYsfoMLC+5+JKFUIWCavR4cCpCRRfeFTu9dqQW4A0/7sD1vSTQG ghzcyKTG4Px86gTnMeHg8EPGlQxxOMRNPeosUZbTOaHvOLkH5JYaRyW7eqr6asTQoYhC +zag== 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: AGRZ1gJA0h7+ndh+VHl9GNM2vZhbQ/4qTxskbrhvMoWd1YDKMHQtYizY YKGVKKt4jQfzYnwvc5cvOkZVrsCrUYR1wSCu4Ynt2nP3Bmo1JIncoqVYyJswb6lFWIC3R+LVyUd NMGAwTDqms7dmEnfKUMApU7e6Ng9S0EIGhi3OXiW8QzZVbGaxtzaMhxHefnCD+HZ0iQ== X-Received: by 2002:a9d:64ce:: with SMTP id n14mr3068342otl.343.1540299778611; Tue, 23 Oct 2018 06:02:58 -0700 (PDT) X-Google-Smtp-Source: AJdET5fBB5/7fKE9ENx88h5VhWbNosrZPabJqCNHoTrCKv3WCQiRJdWUwBwwgSjgG9wUstyjg9zP X-Received: by 2002:a9d:64ce:: with SMTP id n14mr3068308otl.343.1540299777886; Tue, 23 Oct 2018 06:02:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1540299777; cv=none; d=google.com; s=arc-20160816; b=XZGNU1JYDL4VNnDYpGqHhQDFXYfWhpTJbrYTsu38Et0VdCfFDVS2u/2LEjfFUtePBo ISX6JAKTLO16YRL0yUEbgx53TosddOF4OzreuoLb/7c3QiT8jFiHHw5K5jY9z/7Yi7qk qPEtHTxrM6vXj1+LmdJRC5EdFQCY0gaFU09U/EWANj85XTXG1Jb43tSvw/SITK7OHN0i 7MA7jndrK6Iv4kHNhKaByg0tzflVaKXlpcrpM8XlkB8OoYQ6zhTHPTRfeh2A8NKyLmmy JGDQiJnefcD/eO2eX9PFSyZfDObWsO7aFi32gneNGWrABNw2MRizly/WXDZM68j1Qvrn 8iag== 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=axeM6OthVDhoKCv9CcscX9D8Fz/UPJrVkNkh8VHmsuA=; b=azl058Kr7L0PN/i6sLr64LN3AIMMuJnouaSgKksT7J256/hGFjoV7QIh5++clnk52c DF8maPL6BxKbgBpWeVXRO56P2Y5MCyT2wGJu+Om/fbHJTWvq8zlsGmOMZgiSxrqegr8n CN1v5CtaOew+pEAzEX4Mo9qZQpbs8AGtKXvL3ivONNwFlUUbL/MJBd+baJdXoqFDWeww EAtQMgM8I+8/rz92Gi/l38buOzKdWiSltl1JtrPZL+zB/Tv1qhxoIrsjK+Ks/9U811Kk BvdZLbG9lWE7QZkRR+nfY/r7fqvWi2/Ez8uyRou5XgsyChWm7x2mTsDp12WxrE/JUlSY Z+rA== 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 c1si558333oto.262.2018.10.23.06.02.57 for ; Tue, 23 Oct 2018 06:02:57 -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 48BC71596; Tue, 23 Oct 2018 06:02:57 -0700 (PDT) Received: from p8cg001049571a15.arm.com (unknown [10.163.1.17]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 740693F6A8; Tue, 23 Oct 2018 06:02:51 -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 5/5] arm64/mm: Enable HugeTLB migration for contiguous bit HugeTLB pages Date: Tue, 23 Oct 2018 18:32:01 +0530 Message-Id: <1540299721-26484-6-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 Let arm64 subscribe to the previously added framework in which architecture can inform whether a given huge page size is supported for migration. This just overrides the default function arch_hugetlb_migration_supported() and enables migration for all possible HugeTLB page sizes on arm64. With this, HugeTLB migration support on arm64 now covers all possible HugeTLB options. CONT PTE PMD CONT PMD PUD -------- --- -------- --- 4K: 64K 2M 32M 1G 16K: 2M 32M 1G 64K: 2M 512M 16G Reviewed-by: Naoya Horiguchi Signed-off-by: Anshuman Khandual Reviewed-by: Steve Capper Acked-by: Catalin Marinas --- arch/arm64/include/asm/hugetlb.h | 5 +++++ arch/arm64/mm/hugetlbpage.c | 20 ++++++++++++++++++++ 2 files changed, 25 insertions(+) diff --git a/arch/arm64/include/asm/hugetlb.h b/arch/arm64/include/asm/hugetlb.h index e73f685..656f70e 100644 --- a/arch/arm64/include/asm/hugetlb.h +++ b/arch/arm64/include/asm/hugetlb.h @@ -20,6 +20,11 @@ #include +#ifdef CONFIG_ARCH_ENABLE_HUGEPAGE_MIGRATION +#define arch_hugetlb_migration_supported arch_hugetlb_migration_supported +extern bool arch_hugetlb_migration_supported(struct hstate *h); +#endif + static inline pte_t huge_ptep_get(pte_t *ptep) { return READ_ONCE(*ptep); diff --git a/arch/arm64/mm/hugetlbpage.c b/arch/arm64/mm/hugetlbpage.c index 21512ca..f3afdcf 100644 --- a/arch/arm64/mm/hugetlbpage.c +++ b/arch/arm64/mm/hugetlbpage.c @@ -27,6 +27,26 @@ #include #include +#ifdef CONFIG_ARCH_ENABLE_HUGEPAGE_MIGRATION +bool arch_hugetlb_migration_supported(struct hstate *h) +{ + size_t pagesize = huge_page_size(h); + + switch (pagesize) { +#ifdef CONFIG_ARM64_4K_PAGES + case PUD_SIZE: +#endif + case PMD_SIZE: + case CONT_PMD_SIZE: + case CONT_PTE_SIZE: + return true; + } + pr_warn("%s: unrecognized huge page size 0x%lx\n", + __func__, pagesize); + return false; +} +#endif + int pmd_huge(pmd_t pmd) { return pmd_val(pmd) && !(pmd_val(pmd) & PMD_TABLE_BIT);