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 93296C433F5 for ; Fri, 1 Apr 2022 04:24:00 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id B13C36B0073; Fri, 1 Apr 2022 00:23:49 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id AC2318D0003; Fri, 1 Apr 2022 00:23:49 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 9896F8D0002; Fri, 1 Apr 2022 00:23:49 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (relay.hostedemail.com [64.99.140.28]) by kanga.kvack.org (Postfix) with ESMTP id 88FFF6B0073 for ; Fri, 1 Apr 2022 00:23:49 -0400 (EDT) Received: from smtpin03.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay11.hostedemail.com (Postfix) with ESMTP id 4C015801C1 for ; Fri, 1 Apr 2022 04:23:39 +0000 (UTC) X-FDA: 79307016558.03.EB597B2 Received: from mail-pj1-f46.google.com (mail-pj1-f46.google.com [209.85.216.46]) by imf22.hostedemail.com (Postfix) with ESMTP id CF56DC0003 for ; Fri, 1 Apr 2022 04:23:38 +0000 (UTC) Received: by mail-pj1-f46.google.com with SMTP id o68-20020a17090a0a4a00b001c686a48263so4236330pjo.1 for ; Thu, 31 Mar 2022 21:23:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=qjcJFY+K3TS1eivpm/IZvtXBuodt+btawh7qCwUG148=; b=aLfcYTperTFQ/2tIbR+mHV20JN2Ns3yu+0srEpm/ziN5iNA3nwDh/0a63A7jV0YZD2 RSIczCBgkTPHHw+nmH4qZCanrtegxWXh3L2ZbAUo9+Pwxn4VJ+0xGrtwE/98y8QArRz3 MnHReWthknARksAttkLna0sBombylCuqXwVSP106ZPGjfuk36DtCNYSZxxaxrLIU/vvF qR86VCq6VIqAIDQ0eN5sqsr9+4Hiv5rZKnZwdECrNMv3hFrFfNRIGNvY8p+7BXN1ipAe bBZF6rm/yPLifumYjyvulSPNmIpHmGHg6+JSZluoG9sqOhrITKSJpicWb2GOtXLhukIA z/7Q== 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=qjcJFY+K3TS1eivpm/IZvtXBuodt+btawh7qCwUG148=; b=Wk0G1ruVukTBYmvKCEfR48ozufRk3T7GJkiOZpmUgBzJaw3O1JN5X7IO9PzyPMdxw/ TEQJsK1Y+YpWvHpdvyDVBxXQNQKvfCtzERJWTblIvBytfjsQk4pGQXatFLmSw86tqmSn s37LjcVsNTPrrZWjcvIsR7wM/zleSU9X4msl5h/1jgqZAiO+ZHD3zy1xsOZeUjS3eDQT AejhvAnbOvIHDIO9nHGINhjG9vFd10ofu940F3O7q75/Dw04bCkeu1Y8hUUDcgpt8T4X RQ8KDCh3fnINu2ZJzP4jGIYq8q2hvobM4aLdtWRIrUqOkkcuWCa5KIqx6xEVk+Ib5EP6 y9mQ== X-Gm-Message-State: AOAM5302AJV025tZiOc7UE4DqIC/mpqcERbCdkMhM8qw238EFdIeSfqg lsHurnc1cwqW/LmsqR0Nwyt8ZHxsHkgLQKu9QYxrVg== X-Google-Smtp-Source: ABdhPJw1KFriTS/qN+Hd7TLUXOZHnDPbK5zTZ/kCqb67xUFH865508OfPOxPU4nm0ucirJJvqXORmSyHyE+F91G1pWU= X-Received: by 2002:a17:903:2cb:b0:14f:4fb6:2fb0 with SMTP id s11-20020a17090302cb00b0014f4fb62fb0mr43980317plk.172.1648787017568; Thu, 31 Mar 2022 21:23:37 -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: Shakeel Butt Date: Thu, 31 Mar 2022 21:23:26 -0700 Message-ID: Subject: Re: [PATCH v2] mm/list_lru: Fix possible race in memcg_reparent_list_lru_node() To: Andrew Morton Cc: Michal Hocko , Roman Gushchin , Waiman Long , Linux MM , LKML , Muchun Song Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Rspam-User: Authentication-Results: imf22.hostedemail.com; dkim=pass header.d=google.com header.s=20210112 header.b=aLfcYTpe; spf=pass (imf22.hostedemail.com: domain of shakeelb@google.com designates 209.85.216.46 as permitted sender) smtp.mailfrom=shakeelb@google.com; dmarc=pass (policy=reject) header.from=google.com X-Rspamd-Server: rspam03 X-Rspamd-Queue-Id: CF56DC0003 X-Stat-Signature: nmtxob16h95yjhfoyu3p8bq39a5th8mm X-HE-Tag: 1648787018-692902 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 Thu, Mar 31, 2022 at 6:11 PM Andrew Morton w= rote: > > 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 Acked-by: Shakeel Butt