From patchwork Mon Mar 29 18:33:09 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yang Shi X-Patchwork-Id: 12170765 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.5 required=3.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED,DKIM_INVALID,DKIM_SIGNED,FREEMAIL_FORGED_FROMDOMAIN, FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id C26C2C433E0 for ; Mon, 29 Mar 2021 18:34:12 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 577B260231 for ; Mon, 29 Mar 2021 18:34:12 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 577B260231 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id E97486B0083; Mon, 29 Mar 2021 14:34:10 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id E209A6B0085; Mon, 29 Mar 2021 14:34:10 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id CC2526B0087; Mon, 29 Mar 2021 14:34:10 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0132.hostedemail.com [216.40.44.132]) by kanga.kvack.org (Postfix) with ESMTP id B08796B0083 for ; Mon, 29 Mar 2021 14:34:10 -0400 (EDT) Received: from smtpin40.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id 6A4CB8249980 for ; Mon, 29 Mar 2021 18:34:10 +0000 (UTC) X-FDA: 77973761460.40.24900B0 Received: from mail-pg1-f182.google.com (unknown [209.85.215.182]) by imf26.hostedemail.com (Postfix) with ESMTP id 296604142C4D for ; Mon, 29 Mar 2021 18:34:01 +0000 (UTC) Received: by mail-pg1-f182.google.com with SMTP id v186so9965442pgv.7 for ; Mon, 29 Mar 2021 11:34:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=8eLl3881AHbZ4nNjB6RvYqJ53F/ZpOHZuU1QaCJvItA=; b=kwSaBPZO7cNmxBxn0pqrgpKYEG8tAOHuiuyNiyDxCJ5co/V4+pKYYq4FPQlfXlFkVB 5T+u5kfT14LU01mRwKUj4D+eSFyy1ceWJTJSR1Z2ys75gI+Bo1tDjOaTFdJiSMr78KDW aJJerTatPG6tRajq8FGyMWo2ldNPddMXrCpIKW39FwssTzJZkoxIwEmODd2lYwhBRn8K eVaK0fkoHahUGSUCVJFhhlUuT9TwH9NUJ+25lQVka8UPmN7gwQBeQ1U+YygBwUdG8+au B7bT6WXhQY03CcKZtp7qSmKKPeh0QuVPi7Iu/XFw3F5qwa89ns3oqMyzEpV9st69Rvw+ MeKw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=8eLl3881AHbZ4nNjB6RvYqJ53F/ZpOHZuU1QaCJvItA=; b=QfJoG57pLKhDjzEZNmx6i1i6oNcP3OqwV5ityAEo0eQ7DCAR9NEKQmTLxt4oVF4N91 PMwIVJzWnwHYFutzRXQllrpGjXzMidJx2ilCr4RmQO4BfVnsvFyclfZnm0aIo7VZojhM +qfG9uVufPoTuLAc4DZyQJdW7+UcQqRPoWJyVPOydlxYdzFtA8HSI7b+e7D34Wujq5d3 5E3p2QzDjwIek+kE/x4nh0LyLWRumM+QvpjPrJ8NYSJL8zb7pKUWouy6aPkmk33JV53Q yZoBmFP2aKgd1DPxXp57JQlvWGn5NgMb0peVynISnwrhEP7Lbr7Cv7/38u6mtE5/DDoZ BuvQ== X-Gm-Message-State: AOAM532CVAjVyPYcoYpS1tFnj4aAMwf8vUSEfJ1C00cJsMIfowC2BYBV w/4MBPnMgTTbEY1tpqG2qKk= X-Google-Smtp-Source: ABdhPJxyn2xuG80U+SXHgd1NCntqw7s6KhVXO/7VXrjrexxIiOWCkyV1JlwgzlIBdN+psfQDbKvSIg== X-Received: by 2002:a63:5852:: with SMTP id i18mr8939381pgm.337.1617042827282; Mon, 29 Mar 2021 11:33:47 -0700 (PDT) Received: from localhost.localdomain (c-73-93-239-127.hsd1.ca.comcast.net. [73.93.239.127]) by smtp.gmail.com with ESMTPSA id x11sm1151158pjh.0.2021.03.29.11.33.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 29 Mar 2021 11:33:46 -0700 (PDT) From: Yang Shi To: mgorman@suse.de, kirill.shutemov@linux.intel.com, ziy@nvidia.com, mhocko@suse.com, ying.huang@intel.com, hughd@google.com, hca@linux.ibm.com, gor@linux.ibm.com, borntraeger@de.ibm.com, akpm@linux-foundation.org Cc: shy828301@gmail.com, linux-mm@kvack.org, linux-s390@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 3/6] mm: migrate: teach migrate_misplaced_page() about THP Date: Mon, 29 Mar 2021 11:33:09 -0700 Message-Id: <20210329183312.178266-4-shy828301@gmail.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20210329183312.178266-1-shy828301@gmail.com> References: <20210329183312.178266-1-shy828301@gmail.com> MIME-Version: 1.0 X-Rspamd-Server: rspam01 X-Rspamd-Queue-Id: 296604142C4D X-Stat-Signature: 8u5fk9bsan7wf9uo5j1dwh3fxna9ogzk Received-SPF: none (gmail.com>: No applicable sender policy available) receiver=imf26; identity=mailfrom; envelope-from=""; helo=mail-pg1-f182.google.com; client-ip=209.85.215.182 X-HE-DKIM-Result: pass/pass X-HE-Tag: 1617042840-970617 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: In the following patch the migrate_misplaced_page() will be used to migrate THP for NUMA faul too. Prepare to deal with THP. Signed-off-by: Yang Shi --- include/linux/migrate.h | 6 ++++-- mm/memory.c | 2 +- mm/migrate.c | 2 +- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/include/linux/migrate.h b/include/linux/migrate.h index 3a389633b68f..6abd34986cc5 100644 --- a/include/linux/migrate.h +++ b/include/linux/migrate.h @@ -102,14 +102,16 @@ static inline void __ClearPageMovable(struct page *page) #ifdef CONFIG_NUMA_BALANCING extern bool pmd_trans_migrating(pmd_t pmd); extern int migrate_misplaced_page(struct page *page, - struct vm_area_struct *vma, int node); + struct vm_area_struct *vma, int node, + bool compound); #else static inline bool pmd_trans_migrating(pmd_t pmd) { return false; } static inline int migrate_misplaced_page(struct page *page, - struct vm_area_struct *vma, int node) + struct vm_area_struct *vma, int node, + bool compound) { return -EAGAIN; /* can't migrate now */ } diff --git a/mm/memory.c b/mm/memory.c index 003bbf3187d4..7fed578bdc31 100644 --- a/mm/memory.c +++ b/mm/memory.c @@ -4169,7 +4169,7 @@ static vm_fault_t do_numa_page(struct vm_fault *vmf) } /* Migrate to the requested node */ - migrated = migrate_misplaced_page(page, vma, target_nid); + migrated = migrate_misplaced_page(page, vma, target_nid, false); if (migrated) { page_nid = target_nid; flags |= TNF_MIGRATED; diff --git a/mm/migrate.c b/mm/migrate.c index 62b81d5257aa..9c4ae5132919 100644 --- a/mm/migrate.c +++ b/mm/migrate.c @@ -2127,7 +2127,7 @@ static inline bool is_shared_exec_page(struct vm_area_struct *vma, * the page that will be dropped by this function before returning. */ int migrate_misplaced_page(struct page *page, struct vm_area_struct *vma, - int node) + int node, bool compound) { pg_data_t *pgdat = NODE_DATA(node); int isolated;