Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp1448609pxb; Fri, 1 Apr 2022 13:54:05 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxac8HLq50yQ7IU+2s7jzHlDpQ0iZqPOd+s0BbQRYx8ihHc0UEjR0pUPWZGXu+K84D76ApK X-Received: by 2002:a17:902:dac7:b0:154:4899:85db with SMTP id q7-20020a170902dac700b00154489985dbmr12097250plx.9.1648846445687; Fri, 01 Apr 2022 13:54:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1648846445; cv=none; d=google.com; s=arc-20160816; b=yUkpN3QHqHlMiis1oHHFrzMi6Nah5PMOTETzmuuG3Z7MsygCGyly1FqJddn96A0p25 pKS/4uLAbvUXWBH7Yo6KvKzL4VEQi8rbzPkE6400quzCTtFuLUSXKI1L5wLrQVFy2OyG 97YYECKymvhIQtsBxA/ugeEEcBOwm+XZ6jXqRlyteNusB07/6ttSVjmNlgKQPTjqwyY4 F0GiRszBb5RNtAF8pFFMZiHaPi+dVdpF835wcvIaGH4t/6go73iK6WWmJmu2bTuUuQCZ q+MdYfURPrFAVj5uLeMPfcho+0qM1m0oFS5bVmrFiSjgGQsSiu9yRpBxPuMlkOS9t9GI Gkhw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=Pjdj3sPTtnawqXk//QrVvb2n7nto8jXDZrUs+omvxH0=; b=kmOZzwC4I05w2WTkADDcUo/Jr64FxWrEVD1fzKhuZoRrEPFFKsQqTCNkncwLmFJRMb SRY3JpN8Og5AOqie23fC/PGpSvVjO5wU8fucX/aAw73C/kyBL1febF0p6HG+hCxJZ66h Xk8qhnAkB5+j9+G3C/OMv+DGOsTYObgMk+06DVe+MdVYzFJl7It7+W1cM/coHIf8Uf/n NKkmQtiTGmsaI4quf35YWq8/Wn0UxitZc/C64lz9++JXv8C/B89ttnR/fJ2Jm5Fv1zx2 UZtfZrB/S27bRfJE5CC6s3PKCkt6j4evHWtxCPczBFM2O5VIdyMFHJZWMJHeKWXaA8Vt TWyA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.com header.s=susede1 header.b=jLPf1kgL; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=suse.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id f63-20020a636a42000000b003824fa90c8bsi3379610pgc.159.2022.04.01.13.53.51; Fri, 01 Apr 2022 13:54:05 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.com header.s=susede1 header.b=jLPf1kgL; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=suse.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345525AbiDALaa (ORCPT + 99 others); Fri, 1 Apr 2022 07:30:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42864 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238883AbiDALa3 (ORCPT ); Fri, 1 Apr 2022 07:30:29 -0400 Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5689619952E for ; Fri, 1 Apr 2022 04:28:38 -0700 (PDT) Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out1.suse.de (Postfix) with ESMTP id EC8CB21A91; Fri, 1 Apr 2022 11:28:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1648812516; h=from:from:reply-to: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=Pjdj3sPTtnawqXk//QrVvb2n7nto8jXDZrUs+omvxH0=; b=jLPf1kgL18pI5zOjAz0lQ7/yt3xS7BIovLxpUHPbj9bOLzapuzskLJVAZ/TIwvbqI/8DxU iQFBQPMpAzkK9O9pQxl5hclRU2sw626ZaFslvtvzqKP7w9r/46PoukA7BcRpIKKtMR6X6n NCqyIOOvvl7USFHGCQtF/VK0tSNJEng= Received: from suse.cz (unknown [10.100.201.86]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by relay2.suse.de (Postfix) with ESMTPS id 2ADC0A3B83; Fri, 1 Apr 2022 11:28:36 +0000 (UTC) Date: Fri, 1 Apr 2022 13:28:32 +0200 From: Michal Hocko To: Andrew Morton Cc: Shakeel Butt , Roman Gushchin , Waiman Long , linux-mm@kvack.org, linux-kernel@vger.kernel.org, Muchun Song Subject: Re: [PATCH v2] mm/list_lru: Fix possible race in memcg_reparent_list_lru_node() Message-ID: References: <20220330191440.1cc1b2de2b849d1ba93d2ba7@linux-foundation.org> <89B53D3A-FCC5-4107-8D49-81D5B9AE5172@linux.dev> <20220331063956.5uqnab64cqnmcwyr@google.com> <20220331181126.815cfe2b05b4281d32b7bf49@linux-foundation.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220331181126.815cfe2b05b4281d32b7bf49@linux-foundation.org> X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu 31-03-22 18:11:26, Andrew Morton wrote: [...] > 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_node()") > 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: Michal Hocko Thanks! > --- > > mm/list_lru.c | 6 ------ > 1 file changed, 6 deletions(-) > > --- a/mm/list_lru.c~revert-1 > +++ a/mm/list_lru.c > @@ -395,12 +395,6 @@ static void memcg_reparent_list_lru_node > struct list_lru_one *src, *dst; > > /* > - * If there is no lru entry in this nlru, we can skip it immediately. > - */ > - if (!READ_ONCE(nlru->nr_items)) > - return; > - > - /* > * Since list_lru_{add,del} may be called under an IRQ-safe lock, > * we have to use IRQ-safe primitives here to avoid deadlock. > */ > _ -- Michal Hocko SUSE Labs