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 kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9C7DFC433F5 for ; Fri, 1 Apr 2022 04:31:18 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 2F50F6B0071; Fri, 1 Apr 2022 00:31:08 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 2A41F6B0073; Fri, 1 Apr 2022 00:31:08 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 16C886B0075; Fri, 1 Apr 2022 00:31:08 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0160.hostedemail.com [216.40.44.160]) by kanga.kvack.org (Postfix) with ESMTP id 058086B0071 for ; Fri, 1 Apr 2022 00:31:08 -0400 (EDT) Received: from smtpin27.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id B78DF182CFFC8 for ; Fri, 1 Apr 2022 04:30:57 +0000 (UTC) X-FDA: 79307034954.27.6E6D678 Received: from mail-yb1-f179.google.com (mail-yb1-f179.google.com [209.85.219.179]) by imf07.hostedemail.com (Postfix) with ESMTP id B6C234000D for ; Fri, 1 Apr 2022 04:30:56 +0000 (UTC) Received: by mail-yb1-f179.google.com with SMTP id u103so2941471ybi.9 for ; Thu, 31 Mar 2022 21:30:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bytedance-com.20210112.gappssmtp.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=PjBvR0dAm80PmgfJzJt2hGMFU/x9BOyTDKcoptqgwx0=; b=kJMay4fVLDENECNlphQ79WBRJP0IoZbVeM9+X+XSCsug4JDCxGAvzvPx8XhpmbczvQ +Mez9GVXTxH6cTHpmydV6Zl9jFW7BFu5L57zVVZtKCB8rmr5rl2OOlMXeLjth7/p/n/W 6NZtCsncV1WI4uVA+R2rK+ww0E7hReTFAPIAg4x6WxD6lEb24azdIojUTn5Im+XbT/eU 1zkfBy33KTZ2m6exL6gWTUUinKcIeiwqL3JyPxte68Su/HOBtH5UX/ueHuuHvtvHN4mC X3pSDOaqSnYxtowsabCd8VlQvs/7C4Pd4okFYEZ2YNyXw61mQgDgNRJSatC7kYT9NP2w zv7A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=PjBvR0dAm80PmgfJzJt2hGMFU/x9BOyTDKcoptqgwx0=; b=L+sgqRmlj2J2TYpw/rh1v2CRgEiODuB9dRHLJxcVjQP3DX4f58m1NwKLj/ggmf69Ka T/7bV6DqsCPdUbNogQsMQ/cvYefEbgqzgXCP1JRlUOa/+U/nQ2UWEckW1IsLee4BRj3J D2OFEGbMsWOvkaC6H8Z9iKAz77J4p7GhAkGHhowdkvj12BdF4w9Pr/a4ICW/BdD9tKNT eTn7rsS9uQYLB3xr9MRoMCHX8VLa/uvxdSN1XvDs1kX84QSx7QBVSfgKQTJIsX0y8XIP wRE4jte3MstIdLTsej7aUz2pwQqN5K/k/VkUEAfnh/RKMa2TNRBPrVS/cNBE7gzVGFLF tuuw== X-Gm-Message-State: AOAM532kolKw1MRgFKY/wd6kbHAY3q7a0E+zKU2EwXv4KnfgnSPaMmpk twE3ru0n71UJ13jtnlWAYcCXg1Yv+6XvGl4yQ3UAgA== X-Google-Smtp-Source: ABdhPJyc1iNDbSeZ01gaX2/NC8f4Pgl0sHX3EafzDNf7c6y1fcJCaMSsQqApSzbhQhpc25GxuLUZzgehCLNXwMjlgNw= X-Received: by 2002:a25:c049:0:b0:634:6751:e8d2 with SMTP id c70-20020a25c049000000b006346751e8d2mr7293293ybf.6.1648787455925; Thu, 31 Mar 2022 21:30:55 -0700 (PDT) MIME-Version: 1.0 References: <20220330191440.1cc1b2de2b849d1ba93d2ba7@linux-foundation.org> <89B53D3A-FCC5-4107-8D49-81D5B9AE5172@linux.dev> <20220331063956.5uqnab64cqnmcwyr@google.com> <20220331181126.815cfe2b05b4281d32b7bf49@linux-foundation.org> In-Reply-To: <20220331181126.815cfe2b05b4281d32b7bf49@linux-foundation.org> From: Muchun Song Date: Fri, 1 Apr 2022 12:30:19 +0800 Message-ID: Subject: Re: [PATCH v2] mm/list_lru: Fix possible race in memcg_reparent_list_lru_node() To: Andrew Morton Cc: Michal Hocko , Shakeel Butt , Roman Gushchin , Waiman Long , Linux Memory Management List , LKML Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Stat-Signature: s7du5y9b5babjo3h9jmbjnpjrohbs5hr Authentication-Results: imf07.hostedemail.com; dkim=pass header.d=bytedance-com.20210112.gappssmtp.com header.s=20210112 header.b=kJMay4fV; spf=pass (imf07.hostedemail.com: domain of songmuchun@bytedance.com designates 209.85.219.179 as permitted sender) smtp.mailfrom=songmuchun@bytedance.com; dmarc=pass (policy=none) header.from=bytedance.com X-Rspam-User: X-Rspamd-Server: rspam02 X-Rspamd-Queue-Id: B6C234000D X-HE-Tag: 1648787456-720909 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 Fri, Apr 1, 2022 at 9:11 AM Andrew Morton wr= ote: > > On Thu, 31 Mar 2022 09:46:52 +0200 Michal Hocko wrote: > > > On Thu 31-03-22 06:39:56, Shakeel Butt wrote: > > > On Wed, Mar 30, 2022 at 07:48:45PM -0700, Roman Gushchin wrote: > > > > > > > > > > > [...] > > > > > > > > > > > > But honestly, I=E2=80=99d drop the original optimization together w= ith > > > > the fix, if only there is no _real world_ data on the problem and > > > > the improvement. It seems like it has started as a nice simple > > > > improvement, but the race makes it complex and probably not worth > > > > the added complexity and fragility. > > > > > > I agree with dropping the original optimization as it is not really > > > fixing an observed issue which may justify adding some complexity. > > > > Completely agreed. The patch as it is proposed is not really acceptable > > IMHO and I have to say I am worried that this is not the first time we > > are in a situation when a follow up fixes or unrelated patches are > > growing in complexity to fit on top of a performance optimizations whic= h > > do not refer to any actual numbers. > > Yup. I did this: > > From: Andrew Morton > Subject: mm/list_lru.c: revert "mm/list_lru: optimize memcg_reparent_list= _lru_node()" > > 405cc51fc1049c73 ("mm/list_lru: optimize memcg_reparent_list_lru_node()") > has subtle races which are proving ugly to fix. Revert the original > optimization. If quantitative testing indicates that we have a > significant problem here then other implementations can be looked at. > > Fixes: 405cc51fc1049c73 ("mm/list_lru: optimize memcg_reparent_list_lru_n= ode()") > Cc: Waiman Long > Cc: Roman Gushchin > Cc: Muchun Song > Cc: Michal Hocko > Cc: Johannes Weiner > Cc: Shakeel Butt > Signed-off-by: Andrew Morton Reviewed-by: Muchun Song