Received: by 2002:a05:6a10:1287:0:0:0:0 with SMTP id d7csp102301pxv; Wed, 14 Jul 2021 23:50:22 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyhu9I63nUNKrk/MV5+eO06eA/ngQf+Ns08UpT3/Qq2IosHlyrIjCwo4vTgAF3s0KyhavBh X-Received: by 2002:a05:6402:1a57:: with SMTP id bf23mr4539369edb.312.1626331822635; Wed, 14 Jul 2021 23:50:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1626331822; cv=none; d=google.com; s=arc-20160816; b=ihiNGC6jGHLCjDycdEbcUJ873v/yIaxfHMmn/JqCEZBrMe4zcuTF66bdw364o7bWz2 4xXgsC2PSalyIdrm4EdpAXYeAyJCWzTkuZ2IdAfaneYsTKBWsFHnAt+9zSL8tfwEz+/c i1NaIVBaPpoVce20KBtX9VtINeXlSNJbHMiGgROlJy0qShPFLK1M7mVJ1BOMHWWQi/eh H4/o1pUrORSkXZQXQRx+/w0upVi2PLZZFprLNhQ8KgFTcGx7jamqvFImD6nknNCNBFIt X4y1Sli/YwXXXoXrwWZnot01/xZhdbY4Bx8KSP1XtuROvY/u0g0CPr9BpLqCWq/K9Qd0 ExeQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=CxY08Ev5uWlF/WW7yp4XrHQ+Z+LsImiejgZH8Eqdor0=; b=mpy96AjtN5mPpfRsE0n4elJEgotDIg4TFV3v7Dnduxu2pnN9E4b6GgiPJRqW07exjX Ih57NCyCerwvMPs+V5/p8Wu/hLrlauuTVniyNnpYPgaciJR3CVbLh9ew8ryEtFVDqdfU zNCvGoTBnhwuaIQm3iQAkMHsevpQeYIQZNA8bAzfcb+J+4Bf/N8dxPDd20/0f1oV00VL bjNaOkHdRQCOE7KusdvLc4GhXaFc8dQojjSMEQ5FgJzcqoAvfIvV01UReEs+Itq46gVV OFC2jyFOF3UegUhugbJJbU+egrRrLAUCzkH1QmnTt9X2v+zZSQqb+2J9lNQ9dr7lk1E9 /yzA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=RKrbLkVF; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id h26si6445377edr.239.2021.07.14.23.50.00; Wed, 14 Jul 2021 23:50:22 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=RKrbLkVF; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234069AbhGOELB (ORCPT + 99 others); Thu, 15 Jul 2021 00:11:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51942 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231666AbhGOELA (ORCPT ); Thu, 15 Jul 2021 00:11:00 -0400 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E0F22C06175F; Wed, 14 Jul 2021 21:08:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Content-Transfer-Encoding:MIME-Version: References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To: Content-Type:Content-ID:Content-Description; bh=CxY08Ev5uWlF/WW7yp4XrHQ+Z+LsImiejgZH8Eqdor0=; b=RKrbLkVFivA1/kX9kMTQh7qVP/ fmpA4Vbu25qCarcS9FXuAGD5ITwznDdH3orb2GMY//TAMSbFDvs2OaNRb1cP03tUhBdOakxUwe0m6 AJc9UArs3jC9rRErAgTuyC2aGXZ6jZSozojNQkHmMemtq9R4CwA1UOWYgWaNJuUGJeJAtdUgOso5i faUSnnS0gTDIkO6EjGzYA4dwd4Dl+HSbh55CQTCMUQmzknXDYzRHlwkY9PblC5O9HS//VXm0QALA3 lX7VbWjGkXfEK7N9Am5bJMegqBsWJebTIXpy4EnLXcZFcvmQS17cfmikf51E0/tI3+JUW6S8EdmKO 2JXxHlqw==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1m3sdc-002w2d-Iw; Thu, 15 Jul 2021 04:06:35 +0000 From: "Matthew Wilcox (Oracle)" To: linux-kernel@vger.kernel.org Cc: "Matthew Wilcox (Oracle)" , linux-mm@kvack.org, linux-fsdevel@vger.kernel.org, Michal Hocko , Christoph Hellwig Subject: [PATCH v14 037/138] mm/memcg: Convert memcg_check_events to take a node ID Date: Thu, 15 Jul 2021 04:35:23 +0100 Message-Id: <20210715033704.692967-38-willy@infradead.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210715033704.692967-1-willy@infradead.org> References: <20210715033704.692967-1-willy@infradead.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org memcg_check_events only uses the page's nid, so call page_to_nid in the callers to make the interface easier to understand. Signed-off-by: Matthew Wilcox (Oracle) Acked-by: Michal Hocko Reviewed-by: Christoph Hellwig --- mm/memcontrol.c | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/mm/memcontrol.c b/mm/memcontrol.c index f70e33d691aa..1a049bfa0e0a 100644 --- a/mm/memcontrol.c +++ b/mm/memcontrol.c @@ -851,7 +851,7 @@ static bool mem_cgroup_event_ratelimit(struct mem_cgroup *memcg, * Check events in order. * */ -static void memcg_check_events(struct mem_cgroup *memcg, struct page *page) +static void memcg_check_events(struct mem_cgroup *memcg, int nid) { /* threshold event is triggered in finer grain than soft limit */ if (unlikely(mem_cgroup_event_ratelimit(memcg, @@ -862,7 +862,7 @@ static void memcg_check_events(struct mem_cgroup *memcg, struct page *page) MEM_CGROUP_TARGET_SOFTLIMIT); mem_cgroup_threshold(memcg); if (unlikely(do_softlimit)) - mem_cgroup_update_tree(memcg, page_to_nid(page)); + mem_cgroup_update_tree(memcg, nid); } } @@ -5578,7 +5578,7 @@ static int mem_cgroup_move_account(struct page *page, struct lruvec *from_vec, *to_vec; struct pglist_data *pgdat; unsigned int nr_pages = compound ? thp_nr_pages(page) : 1; - int ret; + int nid, ret; VM_BUG_ON(from == to); VM_BUG_ON_PAGE(PageLRU(page), page); @@ -5667,12 +5667,13 @@ static int mem_cgroup_move_account(struct page *page, __unlock_page_memcg(from); ret = 0; + nid = page_to_nid(page); local_irq_disable(); mem_cgroup_charge_statistics(to, nr_pages); - memcg_check_events(to, page); + memcg_check_events(to, nid); mem_cgroup_charge_statistics(from, -nr_pages); - memcg_check_events(from, page); + memcg_check_events(from, nid); local_irq_enable(); out_unlock: unlock_page(page); @@ -6693,7 +6694,7 @@ static int __mem_cgroup_charge(struct page *page, struct mem_cgroup *memcg, local_irq_disable(); mem_cgroup_charge_statistics(memcg, nr_pages); - memcg_check_events(memcg, page); + memcg_check_events(memcg, page_to_nid(page)); local_irq_enable(); out: return ret; @@ -6801,7 +6802,7 @@ struct uncharge_gather { unsigned long nr_memory; unsigned long pgpgout; unsigned long nr_kmem; - struct page *dummy_page; + int nid; }; static inline void uncharge_gather_clear(struct uncharge_gather *ug) @@ -6825,7 +6826,7 @@ static void uncharge_batch(const struct uncharge_gather *ug) local_irq_save(flags); __count_memcg_events(ug->memcg, PGPGOUT, ug->pgpgout); __this_cpu_add(ug->memcg->vmstats_percpu->nr_page_events, ug->nr_memory); - memcg_check_events(ug->memcg, ug->dummy_page); + memcg_check_events(ug->memcg, ug->nid); local_irq_restore(flags); /* drop reference from uncharge_page */ @@ -6866,7 +6867,7 @@ static void uncharge_page(struct page *page, struct uncharge_gather *ug) uncharge_gather_clear(ug); } ug->memcg = memcg; - ug->dummy_page = page; + ug->nid = page_to_nid(page); /* pairs with css_put in uncharge_batch */ css_get(&memcg->css); @@ -6984,7 +6985,7 @@ void mem_cgroup_migrate(struct page *oldpage, struct page *newpage) local_irq_save(flags); mem_cgroup_charge_statistics(memcg, nr_pages); - memcg_check_events(memcg, newpage); + memcg_check_events(memcg, page_to_nid(newpage)); local_irq_restore(flags); } @@ -7214,7 +7215,7 @@ void mem_cgroup_swapout(struct page *page, swp_entry_t entry) */ VM_BUG_ON(!irqs_disabled()); mem_cgroup_charge_statistics(memcg, -nr_entries); - memcg_check_events(memcg, page); + memcg_check_events(memcg, page_to_nid(page)); css_put(&memcg->css); } -- 2.30.2