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=-5.1 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED,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 92E80C41604 for ; Mon, 21 Sep 2020 19:48:26 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 120D42193E for ; Mon, 21 Sep 2020 19:48:25 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="GPLTUfFN" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 120D42193E 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 4487B8E0003; Mon, 21 Sep 2020 15:48:25 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 3FB308E0001; Mon, 21 Sep 2020 15:48:25 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 2E7AD8E0003; Mon, 21 Sep 2020 15:48:25 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0247.hostedemail.com [216.40.44.247]) by kanga.kvack.org (Postfix) with ESMTP id 12B278E0001 for ; Mon, 21 Sep 2020 15:48:25 -0400 (EDT) Received: from smtpin27.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id BFA231EE6 for ; Mon, 21 Sep 2020 19:48:24 +0000 (UTC) X-FDA: 77288105328.27.trees54_170775827147 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin27.hostedemail.com (Postfix) with ESMTP id 9D16E3D668 for ; Mon, 21 Sep 2020 19:48:24 +0000 (UTC) X-HE-Tag: trees54_170775827147 X-Filterd-Recvd-Size: 6831 Received: from mail-lf1-f65.google.com (mail-lf1-f65.google.com [209.85.167.65]) by imf13.hostedemail.com (Postfix) with ESMTP for ; Mon, 21 Sep 2020 19:48:24 +0000 (UTC) Received: by mail-lf1-f65.google.com with SMTP id b12so15385975lfp.9 for ; Mon, 21 Sep 2020 12:48:23 -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=XrwtFZlkzC4xnkOODRwGMeyZ0KnSDnPL+eEdoGaN3l8=; b=GPLTUfFNY19G5YRYzVy+fyWXW3qEBOUJaQ76dfVJYpHeLXOHau+uFYJOldDsPR+2up dGNjTyH1QDsgtUie4o1X/OuBP1GFn1BX1lJx/OqME2M1NFbCnqrLqJWZCOE70sBoPF0m gg09I9JfZh/Cmq5//7vFWggExa/C2CDBiayyuF5oxcU6qtZ+4N2vYI2EPf5HSEewrL6J qH1LTTQhOcJDNbJDJL1OpcxjRF8TCaA6N3Fp+nYZZP5eCWIjpxFiXzkyOhoZ6Qncz7cX E8JOpiZkBwfpHHLsO/WNKapXpvB0AUZ+OZxFQrs7k+F2l/QW46p2yq0y6FL+GIIQEL8U MN6A== 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=XrwtFZlkzC4xnkOODRwGMeyZ0KnSDnPL+eEdoGaN3l8=; b=nAc/EwjQv55MLdKoIYwy2PSShez3uY3OA6NbbY20V2sj/+D6ioEUeTAIHP9EdBZHYy vVEEpY3ln7Y5mik9UKRZc48d69B8DEpbK9oiA5+KoUeMMRwcqdhqzQJhIUoua0bWbvhg 1yKdcwI3nt4AMAP/dLj49ZXmBiC5B0A3Qu3JWymE3bSRH7s5CAQXoz28Y/ZlhugJVk/U ZVnfWIWViOEpXQOMq5XdNXm2qkTEPw/iJ4kyckXEHycBjbcS5qAUpNFye+4NMjwX+l1C sIfuMRqyUvNecZakT8Udd1f0ot+xxA9Fj5csFqn9EYU+GnaJPXO6+AJOcp23msh0uvNu Bp8A== X-Gm-Message-State: AOAM530mPMjE/SgS6q12T3sPAoqEgNiCd4xBTYSz28KQ8ZQyZuKhfuKR vxkjnVx3gyPUJbFGLiYQIwE= X-Google-Smtp-Source: ABdhPJzxBsvJLiIKiIhV8rG2fL2QGs8ROc27J2i7iokxWGUUCL4uk54QartYVw8qx1YDYJcTkdsZxg== X-Received: by 2002:a19:b8a:: with SMTP id 132mr431662lfl.249.1600717702539; Mon, 21 Sep 2020 12:48:22 -0700 (PDT) Received: from pc636 (h5ef52e31.seluork.dyn.perspektivbredband.net. [94.245.46.49]) by smtp.gmail.com with ESMTPSA id y26sm2818159lfy.163.2020.09.21.12.48.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 21 Sep 2020 12:48:22 -0700 (PDT) From: Uladzislau Rezki X-Google-Original-From: Uladzislau Rezki Date: Mon, 21 Sep 2020 21:48:19 +0200 To: Michal Hocko Cc: "Paul E. McKenney" , "Uladzislau Rezki (Sony)" , LKML , RCU , linux-mm@kvack.org, Andrew Morton , Peter Zijlstra , Vlastimil Babka , Thomas Gleixner , "Theodore Y . Ts'o" , Joel Fernandes , Sebastian Andrzej Siewior , Oleksiy Avramchenko Subject: Re: [RFC-PATCH 2/4] mm: Add __rcu_alloc_page_lockless() func. Message-ID: <20200921194819.GA24236@pc636> References: <20200918194817.48921-1-urezki@gmail.com> <20200918194817.48921-3-urezki@gmail.com> <20200921074716.GC12990@dhcp22.suse.cz> <20200921154558.GD29330@paulmck-ThinkPad-P72> <20200921160318.GO12990@dhcp22.suse.cz> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200921160318.GO12990@dhcp22.suse.cz> 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: Hello, Michal. > > > > Yes, I do well remember that you are unhappy with this approach. > > Unfortunately, thus far, there is no solution that makes all developers > > happy. You might be glad to hear that we are also looking into other > > solutions, each of which makes some other developers unhappy. So we > > are at least not picking on you alone. :-/ > > No worries I do not feel like a whipping boy here. But do expect me to > argue against the approach. I would also appreciate it if there was some > more information on other attempts, why they have failed. E.g. why > pre-allocation is not an option that works well enough in most > reasonable workloads. Pre-allocating has some drawbacks: a) It is impossible to predict how many pages will be required to cover a demand that is controlled by different workloads on various systems. b) Memory overhead since we do not know how much pages should be preloaded: 100, 200 or 300 As for memory overhead, it is important to reduce it because of embedded devices like phones, where a low memory condition is a big issue. In that sense pre-allocating is something that we strongly would like to avoid. > > I would also appreciate some more thoughts why we > need to optimize for heavy abusers of RCU (like close(open) extremes). > I think here is a small misunderstanding. Please note, that is not only about performance and corner cases. There is a single argument support of the kvfree_rcu(ptr), where maintaining an array in time is needed. The fallback of the single argument case is extrimely slow. Single-argument details is here: https://lkml.org/lkml/2020/4/28/1626 > > > I strongly agree with Thomas http://lkml.kernel.org/r/87tux4kefm.fsf@nanos.tec.linutronix.de > > > that this optimization is not aiming at reasonable workloads. Really, go > > > with pre-allocated buffer and fallback to whatever slow path you have > > > already. Exposing more internals of the allocator is not going to do any > > > good for long term maintainability. > > > > I suggest that you carefully re-read the thread following that email. > > I clearly remember Thomas not being particularly happy that you optimize > for a corner case. I do not remember there being a consensus that this > is the right approach. There was some consensus that this is better than > a gfp flag. Still quite bad though if you ask me. > > > Given a choice between making users unhappy and making developers > > unhappy, I will side with the users each and every time. > > Well, let me rephrase. It is not only about me (as a developer) being > unhappy but also all the side effects this would have for users when > performance of their favorite workload declines for no apparent reason > just because pcp caches are depleted by an unrelated process. > If depleted, we have a special worker that charge it. From the other hand, the pcplist can be depleted by its nature, what _is_ not wrong. But just in case we secure it since you had a concern about it. Could you please specify a real test case or workload you are talking about? Thank you for your comments and help. -- Vlad Rezki