From patchwork Tue Dec 18 08:24:06 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anshuman Khandual X-Patchwork-Id: 10735103 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 2598C1399 for ; Tue, 18 Dec 2018 08:24:14 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 15CB22A5F0 for ; Tue, 18 Dec 2018 08:24:14 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 09DFA2A643; Tue, 18 Dec 2018 08:24:14 +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 BBA4E2A5F0 for ; Tue, 18 Dec 2018 08:24:12 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id CDA228E0005; Tue, 18 Dec 2018 03:24:11 -0500 (EST) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id C3A228E0001; Tue, 18 Dec 2018 03:24:11 -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 AB7508E0005; Tue, 18 Dec 2018 03:24:11 -0500 (EST) 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 7DE7D8E0001 for ; Tue, 18 Dec 2018 03:24:11 -0500 (EST) Received: by mail-oi1-f200.google.com with SMTP id p131so927610oia.21 for ; Tue, 18 Dec 2018 00:24:11 -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=nMn47GRWVxf/krOr7Ln0IXxIashwj0EQ1ZKiy+lxvjM=; b=Mtp/4UVlU8wQDxsWElA2cV+nGvG6YhWM1yxWsNr9rh1/4SNAu38fdlD1iiaPoYctaT pvyXXpkvV4LNPDidrwcf0/CqV2iXFBJJUAkqcUrQfvrbwnBmTbJATg1nzwFIebGyyyzF lf6kHxae35fqcuyB8f2arJPyl/7K/j4F2ludXpfcaxQ8dp6kuMYCpk4TIV/G8ui1AJh4 5Bz4hxQgcAsjkllk3qo8soB8mtzUlwclSimwMArxAkaoy1/+Frr1TYCjReD4U3tjTLP8 qWPzBmE6+EzVy/Qw0lhmm0ZcCX2tjfV3CXgB+zjvcGAGkVMh7v6dHvWZeQMHBe5dhx1q iNYA== 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+aEWai4nay3Z75wS+8qf5Xqnr6JHTTReXLD8IwqFjwDXDjYCK9YiTR xwNJdv09CD0h92/Viz7miMPMSR1TuCFCYtIZvD1ATKw2wFHusIGUtpKXv+oKGM4jv2YC5DAWz59 sj0PCWSrG034ruBpvdj4ycVP/ZSqVJgs+K34OLBjjhATfsY8stGIt/UzZY6rnnWqjdg== X-Received: by 2002:a9d:5249:: with SMTP id q9mr11306551otg.160.1545121451229; Tue, 18 Dec 2018 00:24:11 -0800 (PST) X-Google-Smtp-Source: AFSGD/W5Zdi5X25k6nKVtKaTg6MPcAFOktysR23hqWRZA4yZsvPEE9czGwjYkpf+5mFzvYHDyNe2 X-Received: by 2002:a9d:5249:: with SMTP id q9mr11306530otg.160.1545121450430; Tue, 18 Dec 2018 00:24:10 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1545121450; cv=none; d=google.com; s=arc-20160816; b=EtnaraOsrUz7YIyTVt7h6zGEZENfEUMkqqvUAOCssFEb3qERQJGwWlDo6uero9vkl/ czq5v9rwo1/hL0w5h8Z9VXDkXxyaw6us8LDVAyWPDg5/sH++ph8xuFiWb74eGJsRqioQ 1rKsOAC0OvS2RwjOblhr9xsMv19hKIQImos7uj5lo3QX+u6vHbsiUoXE1xojsRRiLjU7 jqe3ciHFbScOP8UeaYGjbXqIfmMywIkoYNO+NkFy+NW+yB7I70AOb7ZrXvFV+ZaCe+Ma a62If3MqtQLLowJbYhO0GejC8aujKElngkC7yTG05bJ9pwLE9eMX2d1F9AtOS/qDhT/1 Dx7Q== 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=nMn47GRWVxf/krOr7Ln0IXxIashwj0EQ1ZKiy+lxvjM=; b=Ex83y1rfBiOinmP/6X0gBcuYuxecJpGQUOuMzlqF3XJmWiC3MemWtx3tU04YTTHfYd uL3sNPF9Xqi7jUfn744sccUJzOBu744jfACIJ8ljjiGJjHBY8QJMmXM+//AcH45oVIOn FfbjRP6Ik+ss2lWDOqnQcuf+fBUqxnRl9FtgoXyCZFFXAHFBb8I4pF7vJ40RN/oHDIQB XqA3flPPO7pWHEzFT4eOSHHeh2Visf+eVPKlQq31VTPyb+cOWoEVGqIqCnzouK7e8EGD YmNR67uqpvx/ZQRVc5ZPbyebC9zAC9wNmPQs/KQxsmCnyM4sh6OUAhBrukVqrleEZnhM VcGQ== 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 p126si859562oih.133.2018.12.18.00.24.09 for ; Tue, 18 Dec 2018 00:24:09 -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 F0DC215AB; Tue, 18 Dec 2018 00:24:08 -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 63D783F575; Tue, 18 Dec 2018 00:24:05 -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 1/5] mm/hugetlb: Distinguish between migratability and movability Date: Tue, 18 Dec 2018 13:54:06 +0530 Message-Id: <1545121450-1663-2-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 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: Steve Capper Reviewed-by: Naoya Horiguchi Suggested-by: Michal Hocko Acked-by: Michal Hocko Signed-off-by: Anshuman Khandual --- 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 705a3e9c..795f745 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 f7e4bfd..3020a06 100644 --- a/mm/migrate.c +++ b/mm/migrate.c @@ -1262,7 +1262,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