Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp7809818rwl; Thu, 23 Mar 2023 08:57:28 -0700 (PDT) X-Google-Smtp-Source: AK7set8yUbSrQEqh6BzFddaoN687Z/jeb5G5oKSuQ4GNw+qpSrySpI0gOasMdAZdyc5V/OpzvRhf X-Received: by 2002:aa7:d359:0:b0:4fa:b05e:ced5 with SMTP id m25-20020aa7d359000000b004fab05eced5mr9162325edr.36.1679587048464; Thu, 23 Mar 2023 08:57:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1679587048; cv=none; d=google.com; s=arc-20160816; b=0iVGQgxuz9+Yhd/XWWTBqEfaUfSzawjbhhbaBKwkBagZrcLfIdw40pX/UC/PWiwb7y MNjc3JTeXMGp8uFcHrQ9RWkhcODlmB2z2PMdhA8Ii0xiX/soEkl1179uuJag7kiWKGPT /CJcZVg5C1TyQ4Svhx0kO1kl5JDqsimJr/ozsw01/BJHyJ1buK0fRvS0LkvaDSNyk9M2 09L+fzJQkyDOSgOqLxXROs2EkfRem7wxVlcBg4sCbFPqUBmz1mLFhZ9kLZyVGwv/tHYd JxiV8GMiiKBC0WyM7bE6RdvYYkgTRK9tXQA7TVzSTAv6RTeVGdFYKdnuJSpzvSHguI2V sjWA== 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=MgbjNxnbkhKxp3ayTqCe/JjU9SvNsSkqQJ2eCY+DMZI=; b=I219fdfFe9gcbwFOFqhn2xFXArVGz1PclwSLcZN2XbWDbW1dQGztdRpmMOYnmber9o CCdZG1NSX666ln0r/ukPtvN/EnStxcp1orx9qf0KDc7TFBayC2fjEQrLKPr9y+q/0i2i /AESuu98wurqtxH6pF3muoKzrLM5HqANTXOd/WR88aaS9wJkjvOrgAKvlq0rkUH6Re+J a5eWY2I56JAXMjxl/ky+YBhwhp2q5G3HZcrcJxTOO+6S9zpHNHBBFGm2EJ8rQwY9lYgO ZDDRoUPJ2PHleGoVjzgjgjdk2H1xpE9Emgxp2dBUjB5P5Bh0qA2PWEIUBa6wHFegSLZ+ uPZw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@cmpxchg-org.20210112.gappssmtp.com header.s=20210112 header.b=Uax95WAs; 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 oz38-20020a1709077da600b00939a0e68aa6si3865690ejc.418.2023.03.23.08.56.41; Thu, 23 Mar 2023 08:57:28 -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=Uax95WAs; 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 S231994AbjCWPuq (ORCPT + 99 others); Thu, 23 Mar 2023 11:50:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60482 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231974AbjCWPuo (ORCPT ); Thu, 23 Mar 2023 11:50:44 -0400 Received: from mail-qt1-x82d.google.com (mail-qt1-x82d.google.com [IPv6:2607:f8b0:4864:20::82d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8A32F1BFC for ; Thu, 23 Mar 2023 08:50:42 -0700 (PDT) Received: by mail-qt1-x82d.google.com with SMTP id c19so27059570qtn.13 for ; Thu, 23 Mar 2023 08:50:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cmpxchg-org.20210112.gappssmtp.com; s=20210112; t=1679586641; 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=MgbjNxnbkhKxp3ayTqCe/JjU9SvNsSkqQJ2eCY+DMZI=; b=Uax95WAssNXE3MIDqKKB3u/nqAPCZSxTVSddkIH48B1KHmuIotqFwdvX5KENELaT+e srIzL8LklW2Ssqy1T23s3P4A7Rbrwc7/2yIjR9CSxZFKptYFPEBvPh7JwY7gaMOp6w9N FojxMBtSySjPkBprMQil3VsaB32A1a94++3AgzvX44rNqNkl9uduUufYh1DyMwtlafgk 0nO9yh1udd1cAqnMBwDvHsl7/slURj+lRn5rIZtNHBwsOQfAB+bjCzuke3CE1Sje0C5q +vS4rnZ/lpITkAcIgL5Cs5+LDhdOP+yzSSHCyKfUF8EepIy2Cfeo4UXGo9FZbR6oDODF 5qKA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1679586641; 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=MgbjNxnbkhKxp3ayTqCe/JjU9SvNsSkqQJ2eCY+DMZI=; b=m7qfPW2VX0XvSVjQv05Ax25Zb24DIRwD5AabyKnypc7FU5a8va/Wbd4UlpRXFeDH/5 4Y+gmx4/X5nhQ/3Vzi/yJ4F0yTQwhuihccBj19ZIHfgN+Zx+a7ae9UxjB92JaXFvjUCX DdsLu8+tsz1bD0IRoeIqQD5qQm7lJob6OFgj8HUjP7dmC84gA0MCjOmicWVQmMacjXY1 SqTaot72UTqaqFIKJN5peMFA+E8sR3J0rtzTgoA76Mwim3nf49qS3TXQPScrBVxcM0bQ GL5Auq7q878qj9892rbEw0OwiAjGo6cw5NkUmr+L9zDjFc5jtEMA+RZJy6jpBqqC1xBk tlDg== X-Gm-Message-State: AO0yUKVBcxL/eDpLv2qsQqk/EJaqSDoVwAcFkbXGq+bpBVVocx83bPBQ tv/VASctjFK/r6G/E/3+/hARPA== X-Received: by 2002:a05:622a:1893:b0:3e3:913c:1c9c with SMTP id v19-20020a05622a189300b003e3913c1c9cmr5154867qtc.1.1679586641731; Thu, 23 Mar 2023 08:50:41 -0700 (PDT) Received: from localhost ([2620:10d:c091:400::5:62db]) by smtp.gmail.com with ESMTPSA id i22-20020ac860d6000000b003dd8ad765dcsm7142374qtm.76.2023.03.23.08.50.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 23 Mar 2023 08:50:41 -0700 (PDT) Date: Thu, 23 Mar 2023 11:50:40 -0400 From: Johannes Weiner To: Yosry Ahmed Cc: Tejun Heo , Josef Bacik , Jens Axboe , Zefan Li , Michal Hocko , Roman Gushchin , Shakeel Butt , Muchun Song , Andrew Morton , 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: [RFC PATCH 6/7] workingset: memcg: sleep when flushing stats in workingset_refault() Message-ID: <20230323155040.GB739026@cmpxchg.org> References: <20230323040037.2389095-1-yosryahmed@google.com> <20230323040037.2389095-7-yosryahmed@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230323040037.2389095-7-yosryahmed@google.com> 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 Thu, Mar 23, 2023 at 04:00:36AM +0000, Yosry Ahmed wrote: > In workingset_refault(), we call mem_cgroup_flush_stats_delayed() to > flush stats within an RCU read section and with sleeping disallowed. > Move the call to mem_cgroup_flush_stats_delayed() above the RCU read > section and allow sleeping to avoid unnecessarily performing a lot of > work without sleeping. > > Signed-off-by: Yosry Ahmed > --- > > A lot of code paths call into workingset_refault(), so I am not > generally sure at all whether it's okay to sleep in all contexts or not. > Feedback here would be very helpful. Yes, it's safe.