Message ID | 20230421174020.2994750-3-yosryahmed@google.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp1239670vqo; Fri, 21 Apr 2023 10:45:02 -0700 (PDT) X-Google-Smtp-Source: AKy350bKH9+irJRCkQJFnHiTk10gnNGsLeD8HV9kIC0JNJc/mD1qqalcc19GKzXJ3XYahranWmAq X-Received: by 2002:a17:90a:1f46:b0:24b:3123:8dd8 with SMTP id y6-20020a17090a1f4600b0024b31238dd8mr5938117pjy.27.1682099102003; Fri, 21 Apr 2023 10:45:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1682099101; cv=none; d=google.com; s=arc-20160816; b=kU1GLfDNxTmCVRr1b4u40WepRzkEmPLicdK0RsvPycw7YitPcIWSNZv1Q+q04i4bMQ CSNRW5Lmsom5V2nWOjqNUO0K08m8q73k5DgqwX3mUEp18bof2cX8eQAHyzSGmX7u67Oc iiSi1KMxn13rngeogk1vDbm5TiN0q9rAs+sWVgZ/88X87QEYPGfr2DS55y+qcekmo/Q6 r/9oiolO1LrD2G+58e7eLVTe/ARRXdNNFHVzqbLOsHhN12dTjLXMh7THMnsnz18+7+3o t/5KKLv5TMSlNQOwi/m2t7LLdBez7dABUkN83VGN1M5uKqu1CcoVNjMJNTDuedo39DjG K5jg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:from:subject :message-id:references:mime-version:in-reply-to:date:dkim-signature; bh=ze/kPlw8gotaEo1sJnB2fYrZx8MA/zlu9x0xYHZ+g7E=; b=LAUZhqeLhW/dfe/jPg90yityxBSEL19ORqhmLHI/PcxPDK9zJl2hn68rrFiwe8LBnS 8KUQE/5lgKAjg9i/ijp9INu29K5eZVfPWpO6psFzr3Tf8H7tG3nuqIWb6eI2BXh9NDgP UN0J8dK+6oy7dN6/G35WQpyn45eNFYG4af5IdILSSxl72SPn0gary+iL4A8z6aoySJLx rtZS3pFTpMeyEuVEFl6rw7B678Ss476zOC/VD816dbWgGz+5wgL3dcBdfK17y1dOkREi Ozgeiz4pj9zdfWLVvJoyCbdAHqWubs8ozs3/Z9AAiMcxpkHztxvwwIv6ZGt2oY74/sC6 3l/g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20221208 header.b=evkdgDpS; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id je21-20020a170903265500b001a194bda2desi4420949plb.487.2023.04.21.10.44.48; Fri, 21 Apr 2023 10:45:01 -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=@google.com header.s=20221208 header.b=evkdgDpS; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233367AbjDURko (ORCPT <rfc822;cjcooper78@gmail.com> + 99 others); Fri, 21 Apr 2023 13:40:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40476 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232300AbjDURk2 (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Fri, 21 Apr 2023 13:40:28 -0400 Received: from mail-pj1-x1049.google.com (mail-pj1-x1049.google.com [IPv6:2607:f8b0:4864:20::1049]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EE9E612582 for <linux-kernel@vger.kernel.org>; Fri, 21 Apr 2023 10:40:26 -0700 (PDT) Received: by mail-pj1-x1049.google.com with SMTP id 98e67ed59e1d1-24736ac595aso2200461a91.1 for <linux-kernel@vger.kernel.org>; Fri, 21 Apr 2023 10:40:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20221208; t=1682098826; x=1684690826; h=content-transfer-encoding:cc:to:from:subject:message-id:references :mime-version:in-reply-to:date:from:to:cc:subject:date:message-id :reply-to; bh=ze/kPlw8gotaEo1sJnB2fYrZx8MA/zlu9x0xYHZ+g7E=; b=evkdgDpSyqlLAXON2ZuU2lSGfLM1dQnhdPP+fmyZWeKwGNZTWFCJKPVGhM2bZZGKOC f7YfSGCo2Nf3oXwwYJmGjEDgBvFsw6i76b70QgcRaecrvTKD295qL9CqwnO4UztiMSAR wca4o1fBiZOb2DZIrqp+VDQfAwIcLci5K41MPeROy0/47HRyQgXuMC8OBwZyCxCgwh/S 8f4JUGNY1xeou8G6F0i+W3dKhEWQ3Zv+nckYooRRkUzwRcW77nDMDOwXtSb1IOOWcx0Y jIqwdtbmW/rhz4VKzZZ8k/jeg5TikDCeSv0Wmg2wr9UElKoOoUpGS9AakxlgHuAC0y31 KsJw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1682098826; x=1684690826; h=content-transfer-encoding:cc:to:from:subject:message-id:references :mime-version:in-reply-to:date:x-gm-message-state:from:to:cc:subject :date:message-id:reply-to; bh=ze/kPlw8gotaEo1sJnB2fYrZx8MA/zlu9x0xYHZ+g7E=; b=EWXdK/obcCOZsOmX7JuJxP3nu6RPMu4Vopb6pSXd994RHzHGx0NGjylXq+M/2qrNXb ot0a1hFmJgC6aAkjufdXZ8zvcxzemUfHs7N0oSUPDTWmd7806BgNmQZpuMb12NV2W2iH GOxUA9STuQ/hBNbNIlD8MTQXKB2lql1ZhtdvCfda7s1E4MFBx5BhRJs3Gm+OgI8ix3FV 8hm43kIUFySARAFUrm064iPTWphMD0vrvoNbpFlVQUkQciu68kQ3FiYpOWSFn7DEsdgO arApE1Edzg2rwm+KMYwwE0s8qSMFI4eWZGjosfdmU0av39YA40PKVt5dIfc9z0wjlYF9 v06w== X-Gm-Message-State: AAQBX9d8mwtZrnCGr/haoRja+nQL8SnE9wGF5Nep54y/QLVM/BRuPjkh tfGryJMrKrufwJIHWvwlJt8KkuO0+PBQA8Kh X-Received: from yosry.c.googlers.com ([fda3:e722:ac3:cc00:7f:e700:c0a8:2327]) (user=yosryahmed job=sendgmr) by 2002:a17:90a:3fcd:b0:24b:27db:3cfc with SMTP id u13-20020a17090a3fcd00b0024b27db3cfcmr1409596pjm.8.1682098826505; Fri, 21 Apr 2023 10:40:26 -0700 (PDT) Date: Fri, 21 Apr 2023 17:40:17 +0000 In-Reply-To: <20230421174020.2994750-1-yosryahmed@google.com> Mime-Version: 1.0 References: <20230421174020.2994750-1-yosryahmed@google.com> X-Mailer: git-send-email 2.40.0.634.g4ca3ef3211-goog Message-ID: <20230421174020.2994750-3-yosryahmed@google.com> Subject: [PATCH v5 2/5] memcg: flush stats non-atomically in mem_cgroup_wb_stats() From: Yosry Ahmed <yosryahmed@google.com> To: Alexander Viro <viro@zeniv.linux.org.uk>, Christian Brauner <brauner@kernel.org>, Johannes Weiner <hannes@cmpxchg.org>, Michal Hocko <mhocko@kernel.org>, Roman Gushchin <roman.gushchin@linux.dev>, Shakeel Butt <shakeelb@google.com>, Muchun Song <songmuchun@bytedance.com>, Andrew Morton <akpm@linux-foundation.org>, Tejun Heo <tj@kernel.org> Cc: Jan Kara <jack@suse.cz>, Jens Axboe <axboe@kernel.dk>, " =?utf-8?q?Micha?= =?utf-8?q?l_Koutn=C3=BD?= " <mkoutny@suse.com>, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, cgroups@vger.kernel.org, linux-mm@kvack.org, Yosry Ahmed <yosryahmed@google.com> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-9.6 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE,USER_IN_DEF_DKIM_WL 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: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1763808748119797666?= X-GMAIL-MSGID: =?utf-8?q?1763808748119797666?= |
Series |
cgroup: eliminate atomic rstat flushing
|
|
Commit Message
Yosry Ahmed
April 21, 2023, 5:40 p.m. UTC
The previous patch moved the wb_over_bg_thresh()->mem_cgroup_wb_stats() code path in wb_writeback() outside the lock section. We no longer need to flush the stats atomically. Flush the stats non-atomically. Signed-off-by: Yosry Ahmed <yosryahmed@google.com> Reviewed-by: Michal Koutný <mkoutny@suse.com> Acked-by: Shakeel Butt <shakeelb@google.com> --- mm/memcontrol.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-)
Comments
On Fri, Apr 21, 2023 at 05:40:17PM +0000, Yosry Ahmed wrote: > The previous patch moved the wb_over_bg_thresh()->mem_cgroup_wb_stats() > code path in wb_writeback() outside the lock section. We no longer need > to flush the stats atomically. Flush the stats non-atomically. > > Signed-off-by: Yosry Ahmed <yosryahmed@google.com> > Reviewed-by: Michal Koutný <mkoutny@suse.com> > Acked-by: Shakeel Butt <shakeelb@google.com> Acked-by: Tejun Heo <tj@kernel.org> Thanks.
diff --git a/mm/memcontrol.c b/mm/memcontrol.c index 4b27e245a055..5e79fdf8442b 100644 --- a/mm/memcontrol.c +++ b/mm/memcontrol.c @@ -4648,11 +4648,7 @@ void mem_cgroup_wb_stats(struct bdi_writeback *wb, unsigned long *pfilepages, struct mem_cgroup *memcg = mem_cgroup_from_css(wb->memcg_css); struct mem_cgroup *parent; - /* - * wb_writeback() takes a spinlock and calls - * wb_over_bg_thresh()->mem_cgroup_wb_stats(). Do not sleep. - */ - mem_cgroup_flush_stats_atomic(); + mem_cgroup_flush_stats(); *pdirty = memcg_page_state(memcg, NR_FILE_DIRTY); *pwriteback = memcg_page_state(memcg, NR_WRITEBACK);