From patchwork Tue Apr 13 21:24:13 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yang Shi X-Patchwork-Id: 12201455 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 EB5C4C433B4 for ; Tue, 13 Apr 2021 21:24:39 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 90BD461246 for ; Tue, 13 Apr 2021 21:24:39 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 90BD461246 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 2FF9A6B0075; Tue, 13 Apr 2021 17:24:39 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 2B0946B0078; Tue, 13 Apr 2021 17:24:39 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 1507D6B007B; Tue, 13 Apr 2021 17:24:39 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0089.hostedemail.com [216.40.44.89]) by kanga.kvack.org (Postfix) with ESMTP id EE25F6B0075 for ; Tue, 13 Apr 2021 17:24:38 -0400 (EDT) Received: from smtpin24.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id 9D54235A1350 for ; Tue, 13 Apr 2021 21:24:38 +0000 (UTC) X-FDA: 78028623036.24.DBD60BC Received: from mail-pj1-f47.google.com (mail-pj1-f47.google.com [209.85.216.47]) by imf29.hostedemail.com (Postfix) with ESMTP id 73936E6 for ; Tue, 13 Apr 2021 21:24:36 +0000 (UTC) Received: by mail-pj1-f47.google.com with SMTP id e8-20020a17090a7288b029014e51f5a6baso4358720pjg.2 for ; Tue, 13 Apr 2021 14:24:38 -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=AmtfeB5twZZ4rQ0Q6SWlOUiWCuvN4QYBszoXlhLmsSk=; b=iVr3rN5OZs9UQnNoWS5iJxIk8vfUyYrz+b1F8GvRCkC0gTKt40QJl9BcrF0UdZKSl0 6COTC0Pktx90r15Zy7koDF9/Dn7U6cIvBLPkygAFyAoUOnOlVvGowkPqgG6oP2fcL0Cj gvvEr2nlre03l6pvwggVW7Gvl3x1WE7ykWutoyWLJArbqlXjj7GHYQ55j4IEJFm5bwOG GtyBoUfYkwuuchv88jJ3xQBaWx/v7PgWe18UVhrAv1Pxx8EatORoi6ZI5VS3UE/QHg6F 40fda+SU9So2hGVDJTPjRvdF/ZmqsYs9hZqB16HIJvfQ6B264VAwUzsAqDtzE9tH7iau R0Bw== 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=AmtfeB5twZZ4rQ0Q6SWlOUiWCuvN4QYBszoXlhLmsSk=; b=FbgW8ri9R4bk4zwDY5PWab5jGOswBmJtd9rg3wATphScLYj9m/iooRiInDCy7LROCz OBpqlxukHYmhDXIvm0ebRjCzI/B8w0LtXYFo8V484bEFKSuJM3mfOUBX4fr5kStasAs8 LGwh4E+0rj10zU6B5jie9PBGqyp3HNGgF5Dz4oo4aVlFwa9ExNltqHCZ2GTKCXOER7RV gokXkb2Ki8P6CLORYzA3+vI2ZYEX1DOfjBGbRWOO8Maw01h5gw7HN3ZoC3+LrqzGHouV AE+18dVDh7VQmXZIIrpLqeuOPt9OEv/YTqkoT1CjknY7TvJRilQeWnuUSf9ouKFriHdU gy4A== X-Gm-Message-State: AOAM530d6g+sA/I/ZN9RBjmKEqkVXq6+7T1nXZTXZMqKurchkcV0M0eS +2DM+in+BNfnTAQwDU128KU= X-Google-Smtp-Source: ABdhPJwYiPy8wHeDk26h6rj5vIUXFbUQ74snf6AFlp+1DmZ150lwhBeMHSj2yODGu2UXHK9FslfXkA== X-Received: by 2002:a17:90a:ce0a:: with SMTP id f10mr2001141pju.98.1618349077593; Tue, 13 Apr 2021 14:24:37 -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 fw24sm3069345pjb.21.2021.04.13.14.24.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 13 Apr 2021 14:24:36 -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, gerald.schaefer@linux.ibm.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: [v2 PATCH 4/7] mm: migrate: account THP NUMA migration counters correctly Date: Tue, 13 Apr 2021 14:24:13 -0700 Message-Id: <20210413212416.3273-5-shy828301@gmail.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20210413212416.3273-1-shy828301@gmail.com> References: <20210413212416.3273-1-shy828301@gmail.com> MIME-Version: 1.0 X-Rspamd-Queue-Id: 73936E6 X-Stat-Signature: 11qncubt9xwphafhfck4qyck98886mg8 X-Rspamd-Server: rspam02 Received-SPF: none (gmail.com>: No applicable sender policy available) receiver=imf29; identity=mailfrom; envelope-from=""; helo=mail-pj1-f47.google.com; client-ip=209.85.216.47 X-HE-DKIM-Result: pass/pass X-HE-Tag: 1618349076-865397 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: Now both base page and THP NUMA migration is done via migrate_misplaced_page(), keep the counters correctly for THP. Signed-off-by: Yang Shi Acked-by: Mel Gorman --- mm/migrate.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/mm/migrate.c b/mm/migrate.c index 333448aa53f1..a473f25fbd01 100644 --- a/mm/migrate.c +++ b/mm/migrate.c @@ -2111,6 +2111,7 @@ int migrate_misplaced_page(struct page *page, struct vm_area_struct *vma, LIST_HEAD(migratepages); new_page_t *new; bool compound; + unsigned int nr_pages = thp_nr_pages(page); /* * PTE mapped THP or HugeTLB page can't reach here so the page could @@ -2149,13 +2150,13 @@ int migrate_misplaced_page(struct page *page, struct vm_area_struct *vma, if (nr_remaining) { if (!list_empty(&migratepages)) { list_del(&page->lru); - dec_node_page_state(page, NR_ISOLATED_ANON + - page_is_file_lru(page)); + mod_node_page_state(page_pgdat(page), NR_ISOLATED_ANON + + page_is_file_lru(page), -nr_pages); putback_lru_page(page); } isolated = 0; } else - count_vm_numa_event(NUMA_PAGE_MIGRATE); + count_vm_numa_events(NUMA_PAGE_MIGRATE, nr_pages); BUG_ON(!list_empty(&migratepages)); return isolated;