From patchwork Tue May 18 20:07:58 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yang Shi X-Patchwork-Id: 12265589 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 C6AE5C43462 for ; Tue, 18 May 2021 20:08:28 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 6C13A611B0 for ; Tue, 18 May 2021 20:08:28 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 6C13A611B0 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 0F9998E004A; Tue, 18 May 2021 16:08:28 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 0D28B8E002F; Tue, 18 May 2021 16:08:28 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id E685F8E004A; Tue, 18 May 2021 16:08:27 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0041.hostedemail.com [216.40.44.41]) by kanga.kvack.org (Postfix) with ESMTP id B5A2A8E002F for ; Tue, 18 May 2021 16:08:27 -0400 (EDT) Received: from smtpin13.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id 5663DAF6F for ; Tue, 18 May 2021 20:08:27 +0000 (UTC) X-FDA: 78155439054.13.D23C161 Received: from mail-pl1-f176.google.com (mail-pl1-f176.google.com [209.85.214.176]) by imf08.hostedemail.com (Postfix) with ESMTP id A456F8019393 for ; Tue, 18 May 2021 20:08:23 +0000 (UTC) Received: by mail-pl1-f176.google.com with SMTP id i6so896303plt.4 for ; Tue, 18 May 2021 13:08:26 -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=NJy1kyPl+oDN1LphbCW3pYnL0yTMuSAszJt41Bp1UBM=; b=dz0rHWSH3hdqt902RCPgGvJ7ufXgHBvMlvWjyWU9TgOnB6+uISl/zfQAZqijTUm9lj gIzdnBYXvA5OTtf9+vGaIo0jwxQR+cpjiZ8Vd4kLF3Bm8qKL7Ftb1DGPQJu9vcww60/n K6Jp65JDLmLw4WXCJhZ2Ac7BxaN3ybDLaIDvgZV5WD+AHy+sTTeguiQA4C80YOCigIqg NR0wPWRtJ9pmeno0Ng6pa+ewucpiAMwHYVS7J58cd9LaxHDe4c5Uobo9zm460NtPGgPR gGgvKGG5Tp36HLsIbanO9KPOZfJYy3UdU+g2N+rEZnczLphoMPuOFtQYUy2H6+85PvwG sHYQ== 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=NJy1kyPl+oDN1LphbCW3pYnL0yTMuSAszJt41Bp1UBM=; b=CX61NHsBGF7Tt9NJEr59TG64TFW2DxaiJijXKNE75Vpuj6lJzeVyHzl1QULueKYcUg WvJZ+kQWL93w40XahnHnXDzJJwlTR4wH3japDBBG5aZLPQQsJiDnR9iUrjD/iTb6j50O Q22E4qpjNaZtuOr7Tx+JWeoGypbLSYQ77Bk0KfmB0siSA+CYo7ypQYySQnAa4pjnxrDY /kMFey6VPmvsfDjPHwoRE9KVhO7p9KnW7JpsK3nlXrA1C0iXHSawbvB4k5siQfuTpS1V m+PnsH6rdVvZDkSIQN94vlmaSWGK9krPYQBsf16DxqnICKLXnBZHVvYHe+rAGUGueA0p AK8g== X-Gm-Message-State: AOAM531JAzwRV8nO67CaveYi/7ZE0y+iDpaWrYTocxaRZ1u742S2SNWl bTr3kxl7Hai6fpEjkF7SsEc= X-Google-Smtp-Source: ABdhPJxC5xHJpdW0gj/fkethiDc7bPdRQpp9SNv+bII0C3hZHPfOmRFe/+aSGlwmrPy4u/vr0u2k9w== X-Received: by 2002:a17:90a:ba16:: with SMTP id s22mr7191848pjr.12.1621368506220; Tue, 18 May 2021 13:08:26 -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 r11sm13456600pgl.34.2021.05.18.13.08.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 18 May 2021 13:08:25 -0700 (PDT) From: Yang Shi To: mgorman@suse.de, kirill.shutemov@linux.intel.com, ziy@nvidia.com, ying.huang@intel.com, mhocko@suse.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: [v3 PATCH 4/7] mm: migrate: account THP NUMA migration counters correctly Date: Tue, 18 May 2021 13:07:58 -0700 Message-Id: <20210518200801.7413-5-shy828301@gmail.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20210518200801.7413-1-shy828301@gmail.com> References: <20210518200801.7413-1-shy828301@gmail.com> MIME-Version: 1.0 Authentication-Results: imf08.hostedemail.com; dkim=pass header.d=gmail.com header.s=20161025 header.b=dz0rHWSH; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf08.hostedemail.com: domain of shy828301@gmail.com designates 209.85.214.176 as permitted sender) smtp.mailfrom=shy828301@gmail.com X-Rspamd-Server: rspam05 X-Rspamd-Queue-Id: A456F8019393 X-Stat-Signature: 3md77h5t4dhuyxm9haqkonjsykreh1rg X-HE-Tag: 1621368503-948442 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. Acked-by: Mel Gorman Signed-off-by: Yang Shi --- mm/migrate.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/mm/migrate.c b/mm/migrate.c index 4e0c2644256a..26f79f516100 100644 --- a/mm/migrate.c +++ b/mm/migrate.c @@ -2114,6 +2114,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 @@ -2152,13 +2153,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;