From patchwork Fri Oct 12 03:59:56 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anshuman Khandual X-Patchwork-Id: 10637819 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 8A33113AD for ; Fri, 12 Oct 2018 04:00:37 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 766C02BDF0 for ; Fri, 12 Oct 2018 04:00:37 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6ABFD2BE0B; Fri, 12 Oct 2018 04:00:37 +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 EB8F12BDF0 for ; Fri, 12 Oct 2018 04:00:36 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id CED7D6B000C; Fri, 12 Oct 2018 00:00:35 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id C9BD76B000D; Fri, 12 Oct 2018 00:00:35 -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 B8C7B6B000E; Fri, 12 Oct 2018 00:00:35 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-ot1-f71.google.com (mail-ot1-f71.google.com [209.85.210.71]) by kanga.kvack.org (Postfix) with ESMTP id 8B0856B000C for ; Fri, 12 Oct 2018 00:00:35 -0400 (EDT) Received: by mail-ot1-f71.google.com with SMTP id l92so190830otc.12 for ; Thu, 11 Oct 2018 21:00:35 -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=RNAdn3wYKVi/N1Y7JjNeXQzPvgKFl3FZbSOyBDv5avM=; b=jdnmnyX9nqKwVoEwfmZUeJyXYQU+Cj9bbA3YfTTmsAMeLoLe9PpFJN/v/jiIdtyD64 y49/ZAOuubI9/UWznK5BveTKufNMq9rzcskfMuUKb7pAwSejqg4dWZkET+QKwLHUf2Ub aqZeH5NGDjpsnbaD1/nwFUZGngDmEfVtfcqfhEMRq2/0SU6WyOXMvWygfIcoWc0PJ2ea DfaT4CDoU8v065y8xTBzBQw4gKlmTADh+jSdfzPVjlpoOt04j2MlomZL2XKlVaJLwYti iKNUemmRMVIZNVOAaioZw++nRTaOKpLrfj1fT1pavDWB8uZ2xxZhgkxwkXe4oU4V8JB8 KuWw== 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: ABuFfog9RXovaYBYFLxLsy9AqJxOjALvM9bP7ROt9tQ1GwyzA64sBf0p mi//N3T8rQwX9HIfNoLCIRhybeyWqs6fXRpO78g8dnvD+ms7WsXCF4/4SleT6z5P7Bi8x4F6+eU 9e6YjRRsAvOY9zhCzuBdnT71KP24SEi4c42THaNQ+1uwIiV/m3biB6WgSJWkC+OEd4g== X-Received: by 2002:aca:add8:: with SMTP id w207-v6mr2234892oie.112.1539316835229; Thu, 11 Oct 2018 21:00:35 -0700 (PDT) X-Google-Smtp-Source: ACcGV63ImQuEjJB87HGi4NTmjqem7fsSc/I7c5BzR8434Z6781te9oo5OwftXhnbrkRtiny2Gfeb X-Received: by 2002:aca:add8:: with SMTP id w207-v6mr2234865oie.112.1539316834472; Thu, 11 Oct 2018 21:00:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1539316834; cv=none; d=google.com; s=arc-20160816; b=AS6vCFaeWWYlDWD+gKIXO3ZgtVvz69EF4Mz9sqtGD96ISAaM9XOB9U4wH3uTt8KqXC sTEkUT/nGGSctQBvNhGr1CIT70X3bjlFMSz3WiBMf5w6HVNY9VXPSPqB0UwTq7di17fv B5a88CQg4ce/5T+SKeae2hs6xzMiasIGWsbFceicndRp57Jq1B+lvSlchI/d2u2rRXRP OQ1N6GuUjqf7W9UNfnN8pxk4eOZnuP8NuIWmQBZNBTGL4332e8WO2qo9MUa88mFcXYtr zYO8DYFQSW5pITGGQLxi5mwEUPzkR4cVU9wtWHEyQfCgIqZyr9NWDWpY1GvRFrKN1Poj CYHQ== 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=RNAdn3wYKVi/N1Y7JjNeXQzPvgKFl3FZbSOyBDv5avM=; b=w1M8di2q9DangfSon25XSSkHmjk3AdT6ga7xnkotLYnRriz4257Dh+4QyJvOJzvsUD O4/oLeJkPGnR1mxpqRM58SLfQFOqSY6cgYzrmHX/hL6rS73V66sBBvu6AdDTgOyYcFLV sR889UYgtf8a3JttQTdMC6N/6fixHONBKHHhQYit5YGDPIr9CayRZ/9B0TUoRvl6AnEC 3N9c/ZzfH64aL201ymaPXRogsEAj7FaGxcrkWbcOtvrEXvx8jBHdL/VnPAiF0THgnCa0 sAQrA+B3YxlVA6yhmrCFofT3x6UvX/9l1xic/AgyYpSFjuIlsweRBfO+pBCJD/7dJB5m afTA== 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 k91-v6si14781371otc.259.2018.10.11.21.00.34 for ; Thu, 11 Oct 2018 21:00:34 -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 017761650; Thu, 11 Oct 2018 21:00:34 -0700 (PDT) Received: from p8cg001049571a15.blr.arm.com (p8cg001049571a15.blr.arm.com [10.162.0.72]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 423A43F5B7; Thu, 11 Oct 2018 21:00:30 -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 V2 2/5] mm/hugetlb: Distinguish between migratability and movability Date: Fri, 12 Oct 2018 09:29:56 +0530 Message-Id: <1539316799-6064-3-git-send-email-anshuman.khandual@arm.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1539316799-6064-1-git-send-email-anshuman.khandual@arm.com> References: <1539316799-6064-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. Suggested-by: Michal Hocko Signed-off-by: Anshuman Khandual --- include/linux/hugetlb.h | 30 ++++++++++++++++++++++++++++++ mm/hugetlb.c | 2 +- 2 files changed, 31 insertions(+), 1 deletion(-) diff --git a/include/linux/hugetlb.h b/include/linux/hugetlb.h index 9c1b77f..456cb60 100644 --- a/include/linux/hugetlb.h +++ b/include/linux/hugetlb.h @@ -493,6 +493,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) { @@ -589,6 +614,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 3c21775..a5a111d 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;