Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp4829533rwl; Tue, 28 Mar 2023 11:53:16 -0700 (PDT) X-Google-Smtp-Source: AKy350YYQ+uzUry2mCFvji7zWT3jRpFam35rBZtd/UPUfK2XrzXayIwmdiQ8j3+8aoShXUDsy414 X-Received: by 2002:aa7:c6c8:0:b0:4f9:deb4:b986 with SMTP id b8-20020aa7c6c8000000b004f9deb4b986mr14782576eds.7.1680029596689; Tue, 28 Mar 2023 11:53:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680029596; cv=none; d=google.com; s=arc-20160816; b=dsgKsylz5AkT5Tw6F+wnuL9I7may6g0t7hIIaXCmJfDWpe3fsZl06pWNBzSQ1MtY1T JwfLE6rJzut1dT0boWK1Ktf59uUOWqn2aAHqRlbuB0dwZu1/yXaVTNgMWo5Xbj1DkYlW 9Syza4AlLrFh5KP4GuKd30uBGRGMKSq1Mby4W/TwwFeTv+BsfuCk4/2BQHsu+b1Uf3GL IpcdcpAHX8kYIe7pDpxRwDeLrom8JCdeZS17kAFyS0Q+/bHW44s+U9ZKP97m9TeQlt4b STnLMtzZIfdbVRaLdLxL3hgZL+bbw1W9Q6FadSSlzEhlfOj5/SPtF2CltvlzJZ84uvQ7 lsOw== 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=I8WAHPAOnoIsGbAeWRafsGc8bwd2YsHJNAiOdGspwD8=; b=ngsjRWYBKc2agvAjis0XsL9K05Ce+6im5hjnsYsDg/oSv0YYHb+XBCLX+FtTh/lCGR r9CT/3Oj8suVv30NpjOI9hbEhPrxfzBLBR9LNFF4H3p4M+ep0qIlvXwhF/qwRW8JV+EE HGvJs3R9ZSOA0D5RUN1OFwTl0sDnlHPea/C+d3Jov0ZZALfOJK/xrV9Pnr3UpwTWM7MO 8XAFfn7olga9hx3Jp3jGaLMOJ+ItZCcTXMHEwVAfc5DdVxJmMQyW8ADrw5cjghZUN/Ei Ioar+1G3rhieWye0CD3LVxWVqshjKPeO6+tvzQpWE2g4iVoJnL08W1EjBgwK/5wJU2dL BrLQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@cmpxchg-org.20210112.gappssmtp.com header.s=20210112 header.b=2tUg7yrV; 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=fail (p=NONE sp=NONE dis=NONE) header.from=cmpxchg.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id j1-20020aa7c401000000b004a0b622f8fcsi32626331edq.289.2023.03.28.11.52.46; Tue, 28 Mar 2023 11:53:16 -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=@cmpxchg-org.20210112.gappssmtp.com header.s=20210112 header.b=2tUg7yrV; 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=fail (p=NONE sp=NONE dis=NONE) header.from=cmpxchg.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229735AbjC1Srw (ORCPT + 99 others); Tue, 28 Mar 2023 14:47:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48784 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229511AbjC1Srv (ORCPT ); Tue, 28 Mar 2023 14:47:51 -0400 Received: from mail-ed1-x529.google.com (mail-ed1-x529.google.com [IPv6:2a00:1450:4864:20::529]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E98C11FEC for ; Tue, 28 Mar 2023 11:47:48 -0700 (PDT) Received: by mail-ed1-x529.google.com with SMTP id b20so53715006edd.1 for ; Tue, 28 Mar 2023 11:47:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cmpxchg-org.20210112.gappssmtp.com; s=20210112; t=1680029267; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=I8WAHPAOnoIsGbAeWRafsGc8bwd2YsHJNAiOdGspwD8=; b=2tUg7yrV99oGL+e/zjpM6igGege2u9YnHOxxfFKTkkGmkvvsMuO5PP2CzmH4hK514p OzAsp3rsWzlACLUdxakQBAEu3DoNf1m1iEqZVmxkPC4lkUAa1iTtcOp79RuXlJUkXN4G 1Lm8am1hQ0KiyAtiXbahXpw30N5l7giyxjPWyz9NmYZx7HpzMdk3Vmqu5d4MOCcUyFVu RFjgUxlRIctgglXcHpHZI8WvxXkJJVPGw5ub8PRTGm7qCnNEMvs+AVviN3pW1AWwMm6/ ma702djNMmmFeEwEYG6dbvKLFpzQm7B7QJvUgM6JKqGvshMPXh32s/FylmX7wpm3S4tS Y63w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1680029267; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=I8WAHPAOnoIsGbAeWRafsGc8bwd2YsHJNAiOdGspwD8=; b=aZeEy555GUm+dMKoLV0RvQKZpHeTUXlqMEUXU5YAUnoDScsskcelaKa7I6DtazuYoP dfIVZjD69Hml4C6SpnCtZpBWhuGoHudIyJ6U9N8XKYDqT1+gJ6ppusnJXX8LjpGo5q4r uGQfZKkD+ifXEbIyI744wk+T9xXS6QwUuMjF6Jnk54582bbWVYK8+OI4gaH9n7vBIZcV teGy2IIPMHxRwukjuzRJW1RA83n3f0TmsQxAEva93ZC55mQmT1Xcey9NsPu/x4OEKUpU 49SpgCcUe7fG6/IZaq+jH7WIV55Fa3zZR49E1YS5C9Cx09a2QStgYkmQD/FdfvCctrg1 s/Ig== X-Gm-Message-State: AAQBX9fjFu8lmgViQ8fa3BJSSRg7ayTLjTGURJsMh7EDu1wbNVl/4nfn iicTCSZ3bf40aXKIm/n5VO6tOw== X-Received: by 2002:a05:6402:8d9:b0:4fe:19cb:4788 with SMTP id d25-20020a05640208d900b004fe19cb4788mr17038191edz.42.1680029267444; Tue, 28 Mar 2023 11:47:47 -0700 (PDT) Received: from localhost ([2a02:8070:6387:ab20:5139:4abd:1194:8f0e]) by smtp.gmail.com with ESMTPSA id q18-20020a50c352000000b00501d39f1d2dsm11663627edb.41.2023.03.28.11.47.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 28 Mar 2023 11:47:47 -0700 (PDT) Date: Tue, 28 Mar 2023 14:47:46 -0400 From: Johannes Weiner To: Shakeel Butt Cc: Yosry Ahmed , Tejun Heo , Josef Bacik , Jens Axboe , Zefan Li , Michal Hocko , Roman Gushchin , Muchun Song , Andrew Morton , Michal =?iso-8859-1?Q?Koutn=FD?= , Vasily Averin , cgroups@vger.kernel.org, linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, bpf@vger.kernel.org Subject: Re: [PATCH v1 7/9] workingset: memcg: sleep when flushing stats in workingset_refault() Message-ID: References: <20230328061638.203420-1-yosryahmed@google.com> <20230328061638.203420-8-yosryahmed@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=0.0 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS autolearn=unavailable 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 Tue, Mar 28, 2023 at 08:18:11AM -0700, Shakeel Butt wrote: > > @@ -406,6 +406,8 @@ void workingset_refault(struct folio *folio, void *shadow) > > unpack_shadow(shadow, &memcgid, &pgdat, &eviction, &workingset); > > eviction <<= bucket_order; > > > > + /* Flush stats (and potentially sleep) before holding RCU read lock */ > > I think the only reason we use rcu lock is due to > mem_cgroup_from_id(). Maybe we should add mem_cgroup_tryget_from_id(). > The other caller of mem_cgroup_from_id() in vmscan is already doing > the same and could use mem_cgroup_tryget_from_id(). Good catch. Nothing else in there is protected by RCU. We can just hold the ref instead. > Though this can be done separately to this series (if we decide to do > it at all). Agreed