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 X-Spam-Level: X-Spam-Status: No, score=-2.1 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 106ECC2D0F1 for ; Tue, 31 Mar 2020 17:02:45 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id C967020848 for ; Tue, 31 Mar 2020 17:02:44 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="saDy0un/" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org C967020848 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 623546B0072; Tue, 31 Mar 2020 13:02:44 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 5D56B6B0073; Tue, 31 Mar 2020 13:02:44 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 4C3236B0074; Tue, 31 Mar 2020 13:02:44 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0236.hostedemail.com [216.40.44.236]) by kanga.kvack.org (Postfix) with ESMTP id 34CF16B0072 for ; Tue, 31 Mar 2020 13:02:44 -0400 (EDT) Received: from smtpin19.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id DD97E180AD811 for ; Tue, 31 Mar 2020 17:02:43 +0000 (UTC) X-FDA: 76656276606.19.brush59_17cd6b46d133e X-HE-Tag: brush59_17cd6b46d133e X-Filterd-Recvd-Size: 5196 Received: from mail-lj1-f193.google.com (mail-lj1-f193.google.com [209.85.208.193]) by imf37.hostedemail.com (Postfix) with ESMTP for ; Tue, 31 Mar 2020 17:02:43 +0000 (UTC) Received: by mail-lj1-f193.google.com with SMTP id p14so22779127lji.11 for ; Tue, 31 Mar 2020 10:02:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:date:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=2HZuGdxB+x0mWlELwgsKVlrZ7g66xEPOmCIgcev6cRk=; b=saDy0un/8sSw+q2znKEJCS5QDo1c/iC0dk11oKl+JOJfL4CehAZVMFFlcyu621sIuI TpW5C06zUV0WDCr/X9/mUTfAfTpcbjqBE98ukvR//mgALXjLvwcWhUmG2yPendEbBJeV C2jkfOTrcwrRfyZ9iEiFsTuZ2QY96LLf+hh6QBBR9ZpFP7dmieBaOthVuOTi/2jyDm6O EZX8gF8J1mFOVjktbw6zMgj7Y6WLKLvliXqkQNGs41Huv7GbNswxobuCSn0G7n1CuMKw aYizYm0bVR0VwwbhMRNHf2+N0ignpgtMJyOrgwLV7A5lXZAaYxj+WVQfuxUMQYe9QoQt rpGA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:date:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=2HZuGdxB+x0mWlELwgsKVlrZ7g66xEPOmCIgcev6cRk=; b=n/Es6pJmrOrgtTl91sIV87gkrFDxpY9ntTmwPYX0wf65YSSVngR2wXnWCEIbQnEcQ5 nk0twklIllwizo4YGFLoC1C++GUx43oPljxJU3TnGB30vnvdoTUftjv0HBjf3fcevlmD zQCKhtL2/0HmR9JzAou6MzaelB7puLRET38etD0TcYH5AH2eUMasw3/I+bRfZguglhRl sCLJmPoSpR4I61Ft+xe6JPPpNTNyrdf1OHsbCh8i8ed8SAQYIsOwQdFUoxUAUN5bb62E 28XKzamo7KXvIwLG3im9lVJ2twkh+OCXWt4mVwr6otgUQWx/mEYA3saFnVKF92X6ePqO gTNg== X-Gm-Message-State: AGi0PuaGUjKiPP9tVd9GRq1Z4z1iQK5+pylXMwaQylzMHvzE9RBVGXj6 xpyDuUM9LmW2mcD71Gb3g8E= X-Google-Smtp-Source: APiQypJAzaqWR8QOVGnwEqbA0+F/7BL3cHgAFxPFWoMIz2nlJAcp6b/ae4HVuSEo264GCzY5Cs5SmQ== X-Received: by 2002:a2e:3a19:: with SMTP id h25mr1985208lja.133.1585674160923; Tue, 31 Mar 2020 10:02:40 -0700 (PDT) Received: from pc636 (h5ef52e31.seluork.dyn.perspektivbredband.net. [94.245.46.49]) by smtp.gmail.com with ESMTPSA id 195sm6845074lfi.75.2020.03.31.10.02.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 31 Mar 2020 10:02:40 -0700 (PDT) From: Uladzislau Rezki X-Google-Original-From: Uladzislau Rezki Date: Tue, 31 Mar 2020 19:02:32 +0200 To: Uladzislau Rezki , "Paul E. McKenney" Cc: Joel Fernandes , linux-kernel@vger.kernel.org, linux-mm@kvack.org, rcu@vger.kernel.org, willy@infradead.org, peterz@infradead.org, neilb@suse.com, vbabka@suse.cz, mgorman@suse.de, Andrew Morton , Josh Triplett , Lai Jiangshan , Mathieu Desnoyers , "Paul E. McKenney" , Steven Rostedt Subject: Re: [PATCH RFC] rcu/tree: Use GFP_MEMALLOC for alloc memory to free memory pattern Message-ID: <20200331170232.GA28413@pc636> References: <20200331131628.153118-1-joel@joelfernandes.org> <20200331140433.GA26498@pc636> <20200331150911.GC236678@google.com> <20200331160119.GA27614@pc636> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200331160119.GA27614@pc636> User-Agent: Mutt/1.10.1 (2018-07-13) 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: > > > > Paul was concerned about following scenario with hitting synchronize_rcu(): > > 1. Consider a system under memory pressure. > > 2. Consider some other subsystem X depending on another system Y which uses > > kfree_rcu(). If Y doesn't complete the operation in time, X accumulates > > more memory. > > 3. Since kfree_rcu() on Y hits synchronize_rcu() a lot, it slows it down. > > This causes X to further allocate memory, further causing a chain > > reaction. > > Paul, please correct me if I'm wrong. > > > I see your point and agree that in theory it can happen. So, we should > make it more tight when it comes to rcu_head attachment logic. > Just adding more thoughts about such concern. Even though in theory we can run into something like that. But also please note, that under high memory pressure it also does not mean that (X) will always succeed with further infinite allocations, so memory pressure is something common. As soon as the situation becomes slightly better we do our work much efficient. Practically, i was trying to simulate memory pressure to hit synchronize_rcu() on my test system. By just simulating head-less freeing(for any object) and by always dynamic attaching path. So i could trigger it, but that was really hard to achieve and it happened only few times. So that was not like a constant hit. What i got constantly were: - System got recovered and proceed with "normal" path; - The OOM hit as a final step, when the system is run out of memory fully. So, practically i have not seen massive synchronize_rcu() hit. -- Vlad Rezki