Received: by 2002:a05:6358:111d:b0:dc:6189:e246 with SMTP id f29csp1128492rwi; Mon, 31 Oct 2022 11:43:27 -0700 (PDT) X-Google-Smtp-Source: AMsMyM47lB1n0nvFv8Z1rvm6v1mW9gZZ1hQV1marGyksq4ufuLd8UXn4sKU7DrEIp5D5vz4TuDIG X-Received: by 2002:a05:6a00:78c:b0:56d:2:db06 with SMTP id g12-20020a056a00078c00b0056d0002db06mr15674095pfu.42.1667241806976; Mon, 31 Oct 2022 11:43:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1667241806; cv=none; d=google.com; s=arc-20160816; b=BHSbxNYVPQAPB7IUJaI/L4SWDR0EqDFkKVkJplWLK2908QgJR3InILwnlvFrsPOqJc g2Nqc0KkXJ0d2p6dJFbkBM45n15z/mDBagtp5H8Y+mjmrZD/lOqxneNv7Uxvf+KAH7p4 dAMDupQpDUZc7Ipo2gMHJNE/IR5O8DB4a1rmCqs3UbtsPB2Vdz9PkoMConya5VrY+Lt8 nrtVOlHaHCnsjJmr52MA1XwKAWgVv0pfhPeffR86P6z9hh0JwpK08RF2a9voFEYxXPJE ZFLUHCzCgycDSQout7zQFpFomUtIh4zBQDUSOtCzH/SeVBEnlwBByCJCcUzlrItz1tje jfhQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=/nznu592QecLrPw8CafP0xh5EXfjZ+sQg+B1NGtxhZY=; b=tjFwo2gIBwZo32tvvcZ5Pz10Kmh7X5TB0msqDeoLNNA5+28Ky08taPrrA4rtiD58/+ k/bA0knYkINrw+3illhyjWc0GbCbdFDiCMO2l2A3Q7BTi/SvNjlQW1OZVFuPB8XQB5kf t69Uek4Z79FnUvACaacizVYgmtLePzYnc86fxzaaUuT4JDZssO6WYkSy2jt2lNtw3fDw oqdQ+M+TzgVl4gzZwkMCGN5okhbZxqntm9ia7u3LcgsMsCxCFC8+zF6UXjWl2ODcR3Ug Eb79V9jXUQrFEfc42g63No9J4v8tHk+yQrNqH42QbRUWftH3TcrUmHUIHNfZTlCGHqxx TYdg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@joelfernandes.org header.s=google header.b="oPh/dMCi"; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id bf11-20020a656d0b000000b0043f06af782esi9556258pgb.304.2022.10.31.11.43.13; Mon, 31 Oct 2022 11:43:26 -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=@joelfernandes.org header.s=google header.b="oPh/dMCi"; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229875AbiJaSPu (ORCPT + 98 others); Mon, 31 Oct 2022 14:15:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53290 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229599AbiJaSPr (ORCPT ); Mon, 31 Oct 2022 14:15:47 -0400 Received: from mail-ua1-x92c.google.com (mail-ua1-x92c.google.com [IPv6:2607:f8b0:4864:20::92c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 976D565C6 for ; Mon, 31 Oct 2022 11:15:46 -0700 (PDT) Received: by mail-ua1-x92c.google.com with SMTP id c26so2670139uak.5 for ; Mon, 31 Oct 2022 11:15:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=joelfernandes.org; s=google; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=/nznu592QecLrPw8CafP0xh5EXfjZ+sQg+B1NGtxhZY=; b=oPh/dMCiE+bm1dCTeQbPmsoIIQFSr3txBEeoAJnjUjV96S3kFHI0x5JQ50Iy2zTMzz m+5b9wgk3aQjgWqH59jA6OoJkdyYMc1KAjqL93qGUkO9fBHXjoWQfIa9oZ67Czn89jIT 6fds2aUqV88BluVe9V+Mw79zWcqgVDmivXgNE= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=/nznu592QecLrPw8CafP0xh5EXfjZ+sQg+B1NGtxhZY=; b=5HV6SKS0WWGtYnve85CqOlfuLBNAr3ZA8E4U2Bakmjyr5ZEa3xcuIMbGUfeqsJfzCg yQ/sxDl7JOvEKfCUVpY4JiowQ/fTz87ngHNzldD44tiWriFYCx20Wu9orEGFQwvDj+Z+ gkxhVq302kxosBN8IquV9TPId+Hc56sV/g/PfJVmRrY9QjR0Dh8IOCqUtxKafVM9xJe7 1wzuXg7oJl1nxmzPZU7OxN4v5c07OfbBM/1gm2+oYHzI/QufjZfrpBwhQ2yVZkZpgiKN BnoNAcj1DyJBnBdJCMZYsX4c3/3m+QP4NyyafuC+BQfYezyttFnKuPIHm8ms43DQI9FW H9+g== X-Gm-Message-State: ACrzQf1UXTnH3yXgOeIe3G8ody5bQERRpIlf33lRD05CVirvU/T7IdVh icXjqUyGhQTyipLLoUMqOkCma1jfZR5HCB6qIklKe60RE+g9/A== X-Received: by 2002:ab0:6918:0:b0:3ea:cad4:4de2 with SMTP id b24-20020ab06918000000b003eacad44de2mr3993951uas.46.1667240145574; Mon, 31 Oct 2022 11:15:45 -0700 (PDT) MIME-Version: 1.0 References: <20221019225144.2500095-13-paulmck@kernel.org> <20221024031540.GU5600@paulmck-ThinkPad-P17-Gen-1> <20221024153958.GY5600@paulmck-ThinkPad-P17-Gen-1> <20221024164819.GA5600@paulmck-ThinkPad-P17-Gen-1> In-Reply-To: From: Joel Fernandes Date: Mon, 31 Oct 2022 14:15:33 -0400 Message-ID: Subject: Re: [PATCH rcu 13/14] workqueue: Make queue_rcu_work() use call_rcu_flush() To: Uladzislau Rezki Cc: "Paul E. McKenney" , rcu@vger.kernel.org, linux-kernel@vger.kernel.org, kernel-team@fb.com, rostedt@goodmis.org Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-0.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS,URIBL_BLACK autolearn=no 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 Mon, Oct 31, 2022 at 9:21 AM Uladzislau Rezki wrote: > > On Fri, Oct 28, 2022 at 09:23:47PM +0000, Joel Fernandes wrote: > > On Mon, Oct 24, 2022 at 09:48:19AM -0700, Paul E. McKenney wrote: > > > On Mon, Oct 24, 2022 at 06:25:30PM +0200, Uladzislau Rezki wrote: > > > > > > > > > > You guys might need to agree on the definition of "good" here. Or maybe > > > > > understand the differences in your respective platforms' definitions of > > > > > "good". ;-) > > > > > > > > > Indeed. Bad is when once per-millisecond infinitely :) At least in such use > > > > workload a can detect a power delta and power gain. Anyway, below is a new > > > > trace where i do not use "flush" variant for the kvfree_rcu(): > > > > > > > > > > > > 1. Home screen swipe: [...] > > > > 2. App launches: [...] > > > > > > > > > > > > it is much more better. But. As i wrote earlier there is a patch that i have submitted > > > > some time ago improving kvfree_rcu() batching: > > > > > > > > > > > > commit 51824b780b719c53113dc39e027fbf670dc66028 > > > > Author: Uladzislau Rezki (Sony) > > > > Date: Thu Jun 30 18:33:35 2022 +0200 > > > > > > > > rcu/kvfree: Update KFREE_DRAIN_JIFFIES interval > > > > > > > > Currently the monitor work is scheduled with a fixed interval of HZ/20, > > > > which is roughly 50 milliseconds. The drawback of this approach is > > > > low utilization of the 512 page slots in scenarios with infrequence > > > > kvfree_rcu() calls. For example on an Android system: > > > > > > > > > > > > The trace that i posted was taken without it. > > > > > > And if I am not getting too confused, that patch is now in mainline. > > > So it does make sense to rely on it, then. ;-) > > > > Vlad's patch to change the KFREE_DRAIN_JIFFIES to 5 seconds seems reasonable > > to me. However, can we unify KFREE_DRAIN_JIFFIES and LAZY_FLUSH_JIFFIES ? > > > This is very good. > > Below is a plot that i have taken during one use-case. It is about three > apps usage in parallel. It was done by running "monkey" test: > > wget ftp://vps418301.ovh.net/incoming/monkey_3_apps_slab_usage_5_minutes.png > > i set up three apps as usage scenario: Google Chrome, YoTube and Camera. > I logged the Slab metric from the /proc/meminfo. Sampling rate is 0.1 second. > > Please have a look at results. It reflects what i am saying. non-flush > kvfree RCU variant makes a memory usage higher. What is not acceptable > for our mobile devices and workloads. That does look higher, though honestly about ~5%. But that's just the effect of more "laziness". The graph itself does not show a higher number of shrinker invocations, in fact I think shrinker invocations are not happening much that's why the slab holds more memory. The system may not be under memory pressure? Anyway, I agree with your point of view and I think my concern does not even occur with the latest patch on avoiding RCU that I posted [1], so I come in peace. [1] https://lore.kernel.org/rcu/20221029132856.3752018-1-joel@joelfernandes.org/ I am going to start merging all the lazy patches to ChromeOS 5.10 now including your kfree updates, except for [1] while we discuss it.