From patchwork Tue Oct 23 13:01:57 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anshuman Khandual X-Patchwork-Id: 10653189 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 620EB13BF for ; Tue, 23 Oct 2018 13:02:31 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 494A0295FF for ; Tue, 23 Oct 2018 13:02:31 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3D2D02962F; Tue, 23 Oct 2018 13:02:31 +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 A69BF295FF for ; Tue, 23 Oct 2018 13:02:30 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id B28F56B000D; Tue, 23 Oct 2018 09:02:29 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id AD7A26B000E; Tue, 23 Oct 2018 09:02:29 -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 9C7656B0010; Tue, 23 Oct 2018 09:02:29 -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 70D0C6B000D for ; Tue, 23 Oct 2018 09:02:29 -0400 (EDT) Received: by mail-ot1-f69.google.com with SMTP id d34so690828otb.10 for ; Tue, 23 Oct 2018 06:02:29 -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=RVty6zZAWpEnjruh4Eut3JU+aMchKG4l3xb8FWDC0pw=; b=HEbbrMbyhauHy80StAMfw45XWcQrjZr/aM1i63jeTs0gWNcCNHFc7rdjLl//HmTo7D lsk4MXdadt33KsLNCUaFPjmvAzauZTo+o+0uFFj7xEgw01BfOLtxz9Nynwgx2oMk2yJX 3rtghfYdFX7PgwxmQCUrldH8GxOR20Rp3T160HHguGbl6w825Di+UoVc2ZGJXxVBCCsW +YOuHlVWhT0cA7gczRjIAhz6KfEsF+0Mqb5Xg7jXsU0RFegWWUirH60AuGbaS+OOEYk4 8aKLC8FTR3hcrpWWho0qkEPN35l01RWtMRMrFt+ZxTrBFeBNXDEc5PIKgWJ6B5kCwNGI 1VBA== 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: ABuFfojzEZ3P+A6fyJ6bA0yAznrwpeOwhDkCwuuUllnioxd5E2CFDor8 FWzKd+E3F1A6FP/QilSH+CyEvWpGdll0tQIoktqzgdoFekYK61FFIZXMZWgbdko4xtqjkX9wUro v5sz+xgjA+vX1QJzeaR/NqNAbqAzJxLjcpRWOxq7Y1Q8y5lliv4VnewngyO6gAP2qcw== X-Received: by 2002:a9d:ac:: with SMTP id w41mr32701634oti.168.1540299749204; Tue, 23 Oct 2018 06:02:29 -0700 (PDT) X-Google-Smtp-Source: ACcGV60xwbdBfKjv+4yEVblGnGpQ6k3fWU4Pf/hxy87toHdPHWorWc4UM0KWBsyWq5AxhM9IHgIA X-Received: by 2002:a9d:ac:: with SMTP id w41mr32701387oti.168.1540299745006; Tue, 23 Oct 2018 06:02:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1540299744; cv=none; d=google.com; s=arc-20160816; b=HUBZVYNf40HGFXNyVhbXyUbqw2TLxtXXVwN37WLIgjPYXIBilHB1NTQV+Hj1Akbjem sY9IHzMbxTUwarq6uuh/lKF0XFbFXFGmE92DFDJu0TlZCsy0w6IyG7q5uDj+1lBX8PZw NWmABVxLIQxTMS79PQq6WubzDFImWK34CyxSp2hYoYFuDjs3Hdfy4jIKTldOrSwHWNI7 h2PodDJR2zI0pfT0BUgt36kXR17b8GfrIU2kitlzX35Iw4mxHAL9czZPZW6bGTzKEaqs fqiXEJSa0nJGJBhBwAohCHAwRXzgTOCdjz4Q7A70R6aKNLOKedqlzbt/tyNfnTWqP3q6 Ai2g== 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=RVty6zZAWpEnjruh4Eut3JU+aMchKG4l3xb8FWDC0pw=; b=Qsv7RMvI9+IYYGIJI4bD6CshE4dpsqgybyZ2dm1J9H1jMQilpOeleXcBeknoZ7APu6 8fH6UJPfnBz+zPHn+Vwp6pW1nQ4p28BnVw9yKx5hkTYpJYpPUl7jyVrs9Cg8Wt7+kxQ+ SnapIii6vYF9u7vMaoWAsgp9dFV+Cxl3PlZYwgtJ+uTQZEHBESyS7pZtdXhPVjbnoeMd A2DmJsuLJFtnAoj+Lu0ADaKCJzJF5TfPw/TDRUREj4Aki3LOlTcdORohrsHPTKMEdOep LpdjC6N53659mt8cbHPFSHePOiNFIgCeUET8bEcd9epaaKK1/kTZ3HGb3wwji/639N8y Cbgw== 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 i203-v6si552263oia.112.2018.10.23.06.02.24 for ; Tue, 23 Oct 2018 06:02:24 -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 EC2321596; Tue, 23 Oct 2018 06:02:23 -0700 (PDT) Received: from p8cg001049571a15.arm.com (unknown [10.163.1.17]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 4747F3F6A8; Tue, 23 Oct 2018 06:02:15 -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 1/5] mm/hugetlb: Distinguish between migratability and movability Date: Tue, 23 Oct 2018 18:31:57 +0530 Message-Id: <1540299721-26484-2-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 During huge page allocation it's migratability is checked to determine if it should be placed under movable zones with GFP_HIGHUSER_MOVABLE. But the movability aspect of the huge page could depend on other factors than just migratability. Movability in itself is a distinct property which should not be tied with migratability alone. This differentiates these two and implements an enhanced movability check which also considers huge page size to determine if it is feasible to be placed under a movable zone. At present it just checks for gigantic pages but going forward it can incorporate other enhanced checks. Reviewed-by: Naoya Horiguchi Suggested-by: Michal Hocko Signed-off-by: Anshuman Khandual Acked-by: Michal Hocko Reviewed-by: Steve Capper --- include/linux/hugetlb.h | 30 ++++++++++++++++++++++++++++++ mm/hugetlb.c | 2 +- mm/migrate.c | 2 +- 3 files changed, 32 insertions(+), 2 deletions(-) diff --git a/include/linux/hugetlb.h b/include/linux/hugetlb.h index 087fd5f4..1b858d7 100644 --- a/include/linux/hugetlb.h +++ b/include/linux/hugetlb.h @@ -506,6 +506,31 @@ static inline bool hugepage_migration_supported(struct hstate *h) #endif } +/* + * Movability check is different as compared to migration check. + * It determines whether or not a huge page should be placed on + * movable zone or not. Movability of any huge page should be + * required only if huge page size is supported for migration. + * There wont be any reason for the huge page to be movable if + * it is not migratable to start with. Also the size of the huge + * page should be large enough to be placed under a movable zone + * and still feasible enough to be migratable. Just the presence + * in movable zone does not make the migration feasible. + * + * So even though large huge page sizes like the gigantic ones + * are migratable they should not be movable because its not + * feasible to migrate them from movable zone. + */ +static inline bool hugepage_movable_supported(struct hstate *h) +{ + if (!hugepage_migration_supported(h)) + return false; + + if (hstate_is_gigantic(h)) + return false; + return true; +} + static inline spinlock_t *huge_pte_lockptr(struct hstate *h, struct mm_struct *mm, pte_t *pte) { @@ -602,6 +627,11 @@ static inline bool hugepage_migration_supported(struct hstate *h) return false; } +static inline bool hugepage_movable_supported(struct hstate *h) +{ + return false; +} + static inline spinlock_t *huge_pte_lockptr(struct hstate *h, struct mm_struct *mm, pte_t *pte) { diff --git a/mm/hugetlb.c b/mm/hugetlb.c index 5c390f5..f810cf0 100644 --- a/mm/hugetlb.c +++ b/mm/hugetlb.c @@ -919,7 +919,7 @@ static struct page *dequeue_huge_page_nodemask(struct hstate *h, gfp_t gfp_mask, /* Movability of hugepages depends on migration support. */ static inline gfp_t htlb_alloc_mask(struct hstate *h) { - if (hugepage_migration_supported(h)) + if (hugepage_movable_supported(h)) return GFP_HIGHUSER_MOVABLE; else return GFP_HIGHUSER; diff --git a/mm/migrate.c b/mm/migrate.c index 84381b5..bfda9e4 100644 --- a/mm/migrate.c +++ b/mm/migrate.c @@ -1272,7 +1272,7 @@ static int unmap_and_move_huge_page(new_page_t get_new_page, struct anon_vma *anon_vma = NULL; /* - * Movability of hugepages depends on architectures and hugepage size. + * Migratability of hugepages depends on architectures and their size. * This check is necessary because some callers of hugepage migration * like soft offline and memory hotremove don't walk through page * tables or check whether the hugepage is pmd-based or not before From patchwork Tue Oct 23 13:01:58 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anshuman Khandual X-Patchwork-Id: 10653191 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 A5DFF14DE for ; Tue, 23 Oct 2018 13:02:43 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8C2FD295FA for ; Tue, 23 Oct 2018 13:02:43 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7FFFB29634; Tue, 23 Oct 2018 13:02:43 +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 20E7C295FA for ; Tue, 23 Oct 2018 13:02:43 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 24EFB6B0010; Tue, 23 Oct 2018 09:02:42 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 1FEFA6B0266; Tue, 23 Oct 2018 09:02:42 -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 0ED276B0269; Tue, 23 Oct 2018 09:02:42 -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 DE2ED6B0010 for ; Tue, 23 Oct 2018 09:02:41 -0400 (EDT) Received: by mail-oi1-f199.google.com with SMTP id v2-v6so714818oie.3 for ; Tue, 23 Oct 2018 06:02:41 -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=4bITFLQ/WorHHvvoaq0x/1oK2F0Wat3C94019U2dCkk=; b=HEA0Wx6qOWQyZmHSPC0cgMaYDRIkbVp/o0hlnv1ze03kbre6EiDNPKShf7LsfrjR4h CmVfpXtLuF/CPBdzNmmV5qGriPf11jpDNJfBWT2F2YH7c4whkNWsolw5mBjIQuqZg2s0 caS0pe48ZcvHkwDhBdmLTsZDZnBSvenQUUwNNqR0Se+hXQt2ZmpOOm1xB2uucJPGWhmO r5XBL7vMx9eriQ8N5uAqacqOpzIEubXwn6o4MNd+Ju5m0obyGz8TvNGuoDmVJNTYENAz 7PW8C1luYHyGOyAjmSSQLjvmueWyUTItkXgVFfkly4T8kLYxyDzkJudARsvm/iIsdCuX UGfw== 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: AGRZ1gId8rU9B/qaieq3W1pmRzHk3K+0D4bMzp3p4JIujJwYT6FQXsK0 QpZhX9etX4brEQDePuwKeKJrqxgYCRzmgY3asQ9PUV7LhNITNr1zO2tC/t1dowAvrSRSZaua/QP bUG9fuLelslrpEaLJOK5n6/Pr51d0zT1AuJvfsqXTJ4ohpFuDMQ1JGK+NH25Igc+54w== X-Received: by 2002:a9d:7742:: with SMTP id t2mr3654332otl.148.1540299761668; Tue, 23 Oct 2018 06:02:41 -0700 (PDT) X-Google-Smtp-Source: AJdET5eZorOJFuL4w7X85j+xOrFZ/YXRe5VMwXLEyWmsKV9mit77xROCfq0FrhI5sSVkEEXOYZ9x X-Received: by 2002:a9d:7742:: with SMTP id t2mr3654144otl.148.1540299758015; Tue, 23 Oct 2018 06:02:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1540299757; cv=none; d=google.com; s=arc-20160816; b=XnldvWstYg9IEodV18WehdgkFrIH5g1YS29zozXJ+TGALHDq/CYzGzPC5XSlv6SujJ Bg7+mRzPHiUzPRuFM8o0tBpwGeUb1Lma0e7h17t6Jz1ZHPHoOQSzP74HSgugm4ED3OBD YDwvt/IOJ7kxTEY7lDzoqhAixDeJWXnBa0qVn15f+Sg0iUjfF3+YcvgeNLSsjDqELt5X 9iEIptOZGJq/5LZTQzf35RHXsWxUxa1QrxqXhauVtmPtWZ8dKGgLuC9hN6dMDHLzZkVa +Lwl48/fdYFv1XtxNtuR4UzPNVeZpsqgEkQpymGGBd30fgVaL/j6J4K4uWFD6MiyV354 JZtw== 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=4bITFLQ/WorHHvvoaq0x/1oK2F0Wat3C94019U2dCkk=; b=VMxZO4xZfTUYC3dt5IZCu8iYJ7rb8wdap/mxtNGHMcwEgByND3EfkXpbY/r1qb+YF5 4LdaPUGliYjOrd7laenib7b9S6KDa0vpLgmXERRzZ3rCa5OVH6u8ir2BUPryRHk7wp5G LJ5O0yYNl2VD/5JyDrKWj1i68Gbftj34CfO9QlIMt0mRwEW86K6XRU5ZchKzopRR3vAc 3sG/eB4NfyBX6JmAXtCGw+BChDRQFL9UfJa0GrMFKjn3Ld7dHYdCgdEWhiNIv55ulUo/ wwqQtRhEjFWylZiDxlhA8+JQ/8x1DzFYYY/edBcD+jS0HqI5RoXp1T17E/Y1qpg6xsiZ 0GOg== 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 5si539067otr.231.2018.10.23.06.02.37 for ; Tue, 23 Oct 2018 06:02:37 -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 D04AB15AD; Tue, 23 Oct 2018 06:02:36 -0700 (PDT) Received: from p8cg001049571a15.arm.com (unknown [10.163.1.17]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 15AB23F6A8; Tue, 23 Oct 2018 06:02:24 -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 2/5] mm/hugetlb: Enable PUD level huge page migration Date: Tue, 23 Oct 2018 18:31:58 +0530 Message-Id: <1540299721-26484-3-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 PUD level HugeTLB pages for certain configs (1GB huge page is PUD based on ARM64_4K_PAGES base page size) that can be enabled for migration. It can be achieved through checking for PUD_SHIFT order based HugeTLB pages during migration. Reviewed-by: Naoya Horiguchi Signed-off-by: Anshuman Khandual Reviewed-by: Steve Capper --- include/linux/hugetlb.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/include/linux/hugetlb.h b/include/linux/hugetlb.h index 1b858d7..70bcd89 100644 --- a/include/linux/hugetlb.h +++ b/include/linux/hugetlb.h @@ -497,7 +497,8 @@ static inline bool hugepage_migration_supported(struct hstate *h) { #ifdef CONFIG_ARCH_ENABLE_HUGEPAGE_MIGRATION if ((huge_page_shift(h) == PMD_SHIFT) || - (huge_page_shift(h) == PGDIR_SHIFT)) + (huge_page_shift(h) == PUD_SHIFT) || + (huge_page_shift(h) == PGDIR_SHIFT)) return true; else return false; 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); } /* From patchwork Tue Oct 23 13:02:00 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anshuman Khandual X-Patchwork-Id: 10653195 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 827FA13BF for ; Tue, 23 Oct 2018 13:02:54 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 68CEB2962F for ; Tue, 23 Oct 2018 13:02:54 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5C38A29640; Tue, 23 Oct 2018 13:02:54 +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 EF56F2962F for ; Tue, 23 Oct 2018 13:02:53 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id AB1FD6B026A; Tue, 23 Oct 2018 09:02:52 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id A62B76B026B; Tue, 23 Oct 2018 09:02:52 -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 953516B026C; Tue, 23 Oct 2018 09:02:52 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-oi1-f200.google.com (mail-oi1-f200.google.com [209.85.167.200]) by kanga.kvack.org (Postfix) with ESMTP id 71ED06B026A for ; Tue, 23 Oct 2018 09:02:52 -0400 (EDT) Received: by mail-oi1-f200.google.com with SMTP id o204-v6so698738oif.10 for ; Tue, 23 Oct 2018 06:02:52 -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=9DupIIsNdd/O9YGIMQk1XTVqiKE5e8wT1C73SM5sX04=; b=XoYCJqzs2WXgFs830dkgCJKtQAOlaJxjMqiAcfdHGWfxKPLFLbestt+sYh7MWXMlWy g3l//ike9S6YPlDsV6w6hQdTLQjbse7UVHo8DhNMgX7a3bShGaz/yyLrm74wQP56Nu8g DBgZhKs8/r9+MkQI79nyxjNucIEIc3bf/ecoRwFXiGgDxAbIxixUfW4sSpAu2uFLNtBe 3xkAVR8O2B+bUoAtZghH8nmepFbO5LYcHd6zzdBTA6178EYkI6LZnWemvykdHlmvVmVR aO/lz+LviQHSQIdtIkxZIyPbbZDvHvKMgPpymi1gooyyZNtzc7MkSz0rkcT/Gp1yTMP0 4JHA== 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: ABuFfoidJ70qlrhSDO0EOaxOguZFKJxhOGa7BtMdKczgwL5DMW6YoxIC 7+xkHLc9G8nwcGH9cSnGutaQC00G1YjRsNf+rs/nm+yU/lPvAoz3zBRppYWazcsEanySupjkPV3 rdOIjlH9p567J9ncnQClpDAzRK+EPG5cyF+51Up3UtN9b9g8eoT/g6zc0UYAzZoUSUA== X-Received: by 2002:a9d:3205:: with SMTP id t5mr29753995otc.119.1540299772238; Tue, 23 Oct 2018 06:02:52 -0700 (PDT) X-Google-Smtp-Source: ACcGV63QZY7lS8jhsA2fh7hRBjWs5mehFoIY0L4Y1AAF7zS1zTf6Y0ikkvkuEXmjIbSoDked8Rld X-Received: by 2002:a9d:3205:: with SMTP id t5mr29753955otc.119.1540299771348; Tue, 23 Oct 2018 06:02:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1540299771; cv=none; d=google.com; s=arc-20160816; b=eMoJ7tc1AqkSSTy0OR54cyk7lBI0vwYTHvdiVJANpxLN3HgVwwPENyD/K3NswmqvdD 87OpMmeseE4ydWC32UYNNmPhgk2l+khMfPoDpuXSA3SE0grntv84tFQAuMv6SNW6X+0S Cy2yyEhbEmxCTrmtNLtZGHfqoD1rLZ9hSBm6v7ahU4x4RdDu2YPJDvfMVvcaWXms5/u9 XEPqRkIhSyeOnmLhJfpi9V6Oc1Vd8++48pcfLkEHAlzxUjzqEby73TwjiaN4lYtY4uLh 0c1jTPK4NcQ6lNTTeFSK74Y9W65AnTg8jaWo9IUZNqSbIzS+tZQB2YmlffCQt2NvJzOZ GriQ== 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=9DupIIsNdd/O9YGIMQk1XTVqiKE5e8wT1C73SM5sX04=; b=EdSVow4XKbiXVSPpSQBMInGr30MS3tyA1RC7PP9HOzDVO3HHKfj9f5hn/kwUqD+anv atD3jv8u9mnIw7GM/MUUR5zM+jxFlTQVp89gHWi5G2gBD36uIG+qk/CeZ5qtNWLt2yPC jQmZM8aRr/sqiMS4sWbDweFOKGnq+Rhs7c7G5I2Xw8YkulvvLGhSHG7c5y1ZIRCu7dqI hK4c6dw+2cTNnoGX9Tm8ZdQubWmJFJzKHqgVW7moEweMVOWoTeOVPX9EkVUL/dwMnJaB dO/WVe6+G9CBemoKvITWEq2eSLjbtggt/iyMB7XZA1HV9nJFxpIj3uSg6n3sgVcEOrT/ qjWA== 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 50si579923otk.166.2018.10.23.06.02.51 for ; Tue, 23 Oct 2018 06:02:51 -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 B4EC080D; Tue, 23 Oct 2018 06:02:50 -0700 (PDT) Received: from p8cg001049571a15.arm.com (unknown [10.163.1.17]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 3550E3F6A8; Tue, 23 Oct 2018 06:02:44 -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 4/5] arm64/mm: Enable HugeTLB migration Date: Tue, 23 Oct 2018 18:32:00 +0530 Message-Id: <1540299721-26484-5-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 generic HugeTLB page migration framework. Right now this only works on the following PMD and PUD level HugeTLB page sizes with various kernel base page size combinations. CONT PTE PMD CONT PMD PUD -------- --- -------- --- 4K: NA 2M NA 1G 16K: NA 32M NA 64K: NA 512M NA Reviewed-by: Naoya Horiguchi Signed-off-by: Anshuman Khandual Reviewed-by: Steve Capper --- arch/arm64/Kconfig | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig index a8ae30f..4b3e269 100644 --- a/arch/arm64/Kconfig +++ b/arch/arm64/Kconfig @@ -1331,6 +1331,10 @@ config SYSVIPC_COMPAT def_bool y depends on COMPAT && SYSVIPC +config ARCH_ENABLE_HUGEPAGE_MIGRATION + def_bool y + depends on HUGETLB_PAGE && MIGRATION + menu "Power management options" source "kernel/power/Kconfig" 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);