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 02A59C433EF for ; Fri, 1 Apr 2022 11:28:59 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 5385C8D0002; Fri, 1 Apr 2022 07:28:49 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 4E51C8D0001; Fri, 1 Apr 2022 07:28:49 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 386578D0002; Fri, 1 Apr 2022 07:28:49 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0026.hostedemail.com [216.40.44.26]) by kanga.kvack.org (Postfix) with ESMTP id 26E828D0001 for ; Fri, 1 Apr 2022 07:28:49 -0400 (EDT) Received: from smtpin30.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id D6519824C420 for ; Fri, 1 Apr 2022 11:28:38 +0000 (UTC) X-FDA: 79308087516.30.C2C3641 Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) by imf10.hostedemail.com (Postfix) with ESMTP id 5B5BAC000C for ; Fri, 1 Apr 2022 11:28:38 +0000 (UTC) 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-Rspam-User: Authentication-Results: imf10.hostedemail.com; dkim=pass header.d=suse.com header.s=susede1 header.b=jLPf1kgL; spf=pass (imf10.hostedemail.com: domain of mhocko@suse.com designates 195.135.220.28 as permitted sender) smtp.mailfrom=mhocko@suse.com; dmarc=pass (policy=quarantine) header.from=suse.com X-Rspamd-Server: rspam03 X-Rspamd-Queue-Id: 5B5BAC000C X-Stat-Signature: umnk4g9wgd361wbxi85jrc6ihggesd1g X-HE-Tag: 1648812518-227712 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 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