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