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 Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C398AC433FE for ; Fri, 25 Feb 2022 02:31:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231263AbiBYCcM (ORCPT ); Thu, 24 Feb 2022 21:32:12 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39340 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236757AbiBYCcL (ORCPT ); Thu, 24 Feb 2022 21:32:11 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A031B1B7BA for ; Thu, 24 Feb 2022 18:31:37 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 5A675B82A96 for ; Fri, 25 Feb 2022 02:31:36 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id F221CC340EB; Fri, 25 Feb 2022 02:31:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linux-foundation.org; s=korg; t=1645756295; bh=PvAJKLbGTDuXQhrsOItR1g/2ciHa8Vzn5bomsncQN54=; h=Date:To:From:Subject:From; b=LvNWduhP1fpF/vcoVnaXcVwodWkT1qtoIYU71ubj3/NpINAe2+WPco7u3bHH2iP7F hX7pDskuV2Vz7leFBrdHEpYZIKZhzh/U5uvzuM9MJH61Ua1Ekf3LEzMA93Qk6faajI c4ly8xuzWd4kA6H5PFLOtZcELeFnX7siTgrgFECQ= Date: Thu, 24 Feb 2022 18:31:34 -0800 To: mm-commits@vger.kernel.org, shakeelb@google.com, roman.gushchin@linux.dev, mhocko@suse.com, hannes@cmpxchg.org, richard.weiyang@gmail.com, akpm@linux-foundation.org From: Andrew Morton Subject: + mm-memcg-move-generation-assignment-and-comparison-together.patch added to -mm tree Message-Id: <20220225023134.F221CC340EB@smtp.kernel.org> Precedence: bulk Reply-To: linux-kernel@vger.kernel.org List-ID: X-Mailing-List: mm-commits@vger.kernel.org The patch titled Subject: mm/memcg: move generation assignment and comparison together has been added to the -mm tree. Its filename is mm-memcg-move-generation-assignment-and-comparison-together.patch This patch should soon appear at https://ozlabs.org/~akpm/mmots/broken-out/mm-memcg-move-generation-assignment-and-comparison-together.patch and later at https://ozlabs.org/~akpm/mmotm/broken-out/mm-memcg-move-generation-assignment-and-comparison-together.patch Before you just go and hit "reply", please: a) Consider who else should be cc'ed b) Prefer to cc a suitable mailing list as well c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's *** Remember to use Documentation/process/submit-checklist.rst when testing your code *** The -mm tree is included into linux-next and is updated there every 3-4 working days ------------------------------------------------------ From: Wei Yang Subject: mm/memcg: move generation assignment and comparison together For each round-trip, we assign generation on first invocation and compare it on subsequent invocations. Let's move them together to make it more self-explaining. Also this reduces a check on prev. Link: https://lkml.kernel.org/r/20220225003437.12620-4-richard.weiyang@gmail.com Signed-off-by: Wei Yang Cc: Johannes Weiner Cc: Michal Hocko Cc: Roman Gushchin Cc: Shakeel Butt Signed-off-by: Andrew Morton --- mm/memcontrol.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) --- a/mm/memcontrol.c~mm-memcg-move-generation-assignment-and-comparison-together +++ a/mm/memcontrol.c @@ -1045,7 +1045,14 @@ struct mem_cgroup *mem_cgroup_iter(struc mz = root->nodeinfo[reclaim->pgdat->node_id]; iter = &mz->iter; - if (prev && reclaim->generation != iter->generation) + /* + * On first invocation, assign iter->generation to + * reclaim->generation. + * On subsequent invocations, make sure no one else jump in. + */ + if (!prev) + reclaim->generation = iter->generation; + else if (reclaim->generation != iter->generation) goto out_unlock; while (1) { @@ -1105,8 +1112,6 @@ struct mem_cgroup *mem_cgroup_iter(struc if (!memcg) iter->generation++; - else if (!prev) - reclaim->generation = iter->generation; } out_unlock: _ Patches currently in -mm which might be from richard.weiyang@gmail.com are mm-memcg-mem_cgroup_per_node-is-already-set-to-0-on-allocation.patch mm-memcg-retrieve-parent-memcg-from-cssparent.patch mm-memcg-set-memcg-after-css-verified-and-got-reference.patch mm-memcg-set-pos-to-prev-unconditionally.patch mm-memcg-move-generation-assignment-and-comparison-together.patch mm-page_alloc-add-same-penalty-is-enough-to-get-round-robin-order.patch mm-page_alloc-add-penalty-to-local_node.patch memcg-do-not-tweak-node-in-alloc_mem_cgroup_per_node_info.patch