From mboxrd@z Thu Jan 1 00:00:00 1970 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=-9.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED 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 E3641C388F9 for ; Tue, 27 Oct 2020 13:36:54 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 3D0A5218AC for ; Tue, 27 Oct 2020 13:36:54 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=suse.com header.i=@suse.com header.b="ZOf89cP7" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 3D0A5218AC Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=suse.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 7ED816B006C; Tue, 27 Oct 2020 09:36:53 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 776B06B006E; Tue, 27 Oct 2020 09:36:53 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 63FB46B0070; Tue, 27 Oct 2020 09:36:53 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id 341D16B006C for ; Tue, 27 Oct 2020 09:36:53 -0400 (EDT) Received: from smtpin17.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id C40D71EE6 for ; Tue, 27 Oct 2020 13:36:52 +0000 (UTC) X-FDA: 77417805864.17.park20_41018b82727c Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin17.hostedemail.com (Postfix) with ESMTP id A888E180D0181 for ; Tue, 27 Oct 2020 13:36:52 +0000 (UTC) X-HE-Tag: park20_41018b82727c X-Filterd-Recvd-Size: 3390 Received: from mx2.suse.de (mx2.suse.de [195.135.220.15]) by imf08.hostedemail.com (Postfix) with ESMTP for ; Tue, 27 Oct 2020 13:36:52 +0000 (UTC) X-Virus-Scanned: by amavisd-new at test-mx.suse.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1603805811; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=vVfsint97M+naTXXxHG4OXnQeWqqb/vQC4U46ftK8Ro=; b=ZOf89cP7tkb4NTIdZZR2NsUHBbPHti3VCEVDz7sHKYwFFlg+572/0TcwmJQL2wSN9l1bqg ry53bKL9p748UXGDWGHYu695j2Q393Aj863UtWvB99OIxR8DCXMcXG+WFsOET6susjdi7N FQtmPeB0VLsWf/hrCYgXnKHvYqSBwKQ= Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 09CF1AF2F; Tue, 27 Oct 2020 13:36:51 +0000 (UTC) Date: Tue, 27 Oct 2020 14:36:39 +0100 From: Michal Hocko To: Muchun Song Cc: hannes@cmpxchg.org, vdavydov.dev@gmail.com, akpm@linux-foundation.org, shakeelb@google.com, guro@fb.com, iamjoonsoo.kim@lge.com, laoar.shao@gmail.com, chris@chrisdown.name, christian.brauner@ubuntu.com, peterz@infradead.org, mingo@kernel.org, keescook@chromium.org, tglx@linutronix.de, esyr@redhat.com, surenb@google.com, areber@redhat.com, elver@google.com, linux-kernel@vger.kernel.org, cgroups@vger.kernel.org, linux-mm@kvack.org Subject: Re: [PATCH 5/5] mm: memcontrol: Simplify the mem_cgroup_page_lruvec Message-ID: <20201027133639.GT20500@dhcp22.suse.cz> References: <20201027080256.76497-1-songmuchun@bytedance.com> <20201027080256.76497-6-songmuchun@bytedance.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20201027080256.76497-6-songmuchun@bytedance.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: On Tue 27-10-20 16:02:56, Muchun Song wrote: > We can reuse the code of mem_cgroup_lruvec() to simplify the code > of the mem_cgroup_page_lruvec(). yes, removing the code duplication is reasonable. But ... > > Signed-off-by: Muchun Song > --- > include/linux/memcontrol.h | 44 +++++++++++++++++++++++++++----------- > mm/memcontrol.c | 40 ---------------------------------- > 2 files changed, 32 insertions(+), 52 deletions(-) > > diff --git a/include/linux/memcontrol.h b/include/linux/memcontrol.h > index 95807bf6be64..5e8480e54cd8 100644 > --- a/include/linux/memcontrol.h > +++ b/include/linux/memcontrol.h > @@ -451,16 +451,9 @@ mem_cgroup_nodeinfo(struct mem_cgroup *memcg, int nid) > return memcg->nodeinfo[nid]; > } > > -/** > - * mem_cgroup_lruvec - get the lru list vector for a memcg & node > - * @memcg: memcg of the wanted lruvec > - * > - * Returns the lru list vector holding pages for a given @memcg & > - * @node combination. This can be the node lruvec, if the memory > - * controller is disabled. > - */ > -static inline struct lruvec *mem_cgroup_lruvec(struct mem_cgroup *memcg, > - struct pglist_data *pgdat) > +static inline struct lruvec *mem_cgroup_node_lruvec(struct mem_cgroup *memcg, > + struct pglist_data *pgdat, > + int nid) This is just wrong interface. Either take nid or pgdat. You do not want both because that just begs for wrong usage. -- Michal Hocko SUSE Labs