Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp1450021pxk; Fri, 18 Sep 2020 12:50:20 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyj+dCdHwLgCEZSEF3++40OroSUifzWpmiqmT7JMcE9LF5B/zE5Zqz1OnbJ4l5fFnutzLAO X-Received: by 2002:a17:906:e0c7:: with SMTP id gl7mr37101174ejb.109.1600458620039; Fri, 18 Sep 2020 12:50:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1600458620; cv=none; d=google.com; s=arc-20160816; b=bnwKMbYBC0Rx2XfY5ov3STO4d94UHEe9F4WXccfrH54lNv4RZkKw68Ax5dcyc4lrHC M2y1lVP4EQrflCt2xYnsnRyDIHWpO0zwjEGSo2Ex7IskZh7Rt0zdA9UN7e2Sdpss/8Ya AhbK5LaP7gsIpIMOvl55gj5qDUpS8VZKWb0m6vZxkRXJC+xsJKy9TfSBSDmxEJC9pOFI j0UB/d418zqfwDgr89tlh55hAeRrWhgqDf/EClJAArkzsFTNw03FYKqhdVbrox49E0ac TcAYuGP+G1uN9wIWEjIN6G1QXcYup3/fQ/81ePDiErNChpRad19JmHZ0tv0nro8BC40s 5KOA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=pihU19ZyV1tR9rxjJBUfTFPiShIHT6wFJWQRUBqDuSU=; b=nCtaJNvDw5BVddh5617e1BrOBNSvo3ZNvTIM+5az5tuRognvs5HRgAeBz1ex8QBC8w X5xP8ddl8OhT+hbmoK53jXrSQVpc1eCHQMciOghTmuRdF2u016qCPfld4MwtXnwb1Xcv qAvM/x6SDuUUo2aOPThCu097/8URVY75H3BilS7t3ZLLKR6BltN9sJQA/vlbOic86eeR F58zXTK0JvKmXbvNknPwTpvMXyzTmvb8o6CeohDOYJz5dRAvZu6iggj/bj79hc6OE2NB G3eB+5QEdO+m7b2sagmh07OWXRhagG5WlSaW81F37EIKc08Ipfy5acfOTRMNqVVq+N1W 3xIw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=bS8wqurD; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id l23si2975390ejn.7.2020.09.18.12.49.56; Fri, 18 Sep 2020 12:50:20 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=bS8wqurD; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726392AbgIRTsp (ORCPT + 99 others); Fri, 18 Sep 2020 15:48:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48636 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726367AbgIRTsm (ORCPT ); Fri, 18 Sep 2020 15:48:42 -0400 Received: from mail-lj1-x241.google.com (mail-lj1-x241.google.com [IPv6:2a00:1450:4864:20::241]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 667D5C0613CE; Fri, 18 Sep 2020 12:48:42 -0700 (PDT) Received: by mail-lj1-x241.google.com with SMTP id u4so6005182ljd.10; Fri, 18 Sep 2020 12:48:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=pihU19ZyV1tR9rxjJBUfTFPiShIHT6wFJWQRUBqDuSU=; b=bS8wqurDjQBWPYzxoQcs/RTFMBIpDOsIN5r0Vh5wX+3vYkIyVlIjt5XSIMtOJstZVK wb5EiRTsmWoA0Cp8WZy/jSjGkQR2T6ZuFRH3hci0DFMhtnD06XU2yZICKtAEn5vg/hpd KV0eJycW4/86TauW7eoyQ/E0dz+UDN5qU4WOpJWlS2yLKFi/bDBT41Pc1qzrlDzkKvDB OeZDVLMLFzjzLZ6QzDVdRIkQ+hIk1N2s3SUEwFL47OvxQ4+WZ1kmaqriNQlipgbfuCZo kCOVW9IhZ6C/HiDlwve9rHe/GOCZdKrMrh9qjgyKuVs3P/uxNZIC9xHjIzYdnZfq/yyK JuvA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=pihU19ZyV1tR9rxjJBUfTFPiShIHT6wFJWQRUBqDuSU=; b=fA43XjVQK/czkpTOHp0UqDsObxAunSnLPH1o7zaeZQt4F0Oc1n1VCNRNij3cOsb1BJ hyQqWSJwx4tFkuXQHOgOZZuBd4stljBzbDv5VcjWliULQlBhrdjCJ/o+6/KLYl/PunOP EGzaEVD5jQ0jzDqaOYYqual9IVLKi5IzcJBB44zK8qwGyPSNng80xcv6magXuscw8B81 e/lOy0MgGUiL/yqNZQofLvogjmQ2vR8TZvWZTSUYSx7z1hfnX2h14hKTiuBTTtE7ZHlp iJBYSYFqykSgzJ4AEKrdAcDlqSIdSnx/PvGpZxLsu3UMJ6fUVb98i6P7XKsR9yixVoSF GPBw== X-Gm-Message-State: AOAM530+xcMHVxtE17MTGjshFponjlZf6hYHH4O2cY3Ihj/d8DQaZQnu eNqdASt8o48te0zY3GFuaA8Tjq00jSELUHlz X-Received: by 2002:a2e:911:: with SMTP id 17mr13543936ljj.207.1600458520502; Fri, 18 Sep 2020 12:48:40 -0700 (PDT) Received: from pc638.lan (h5ef52e31.seluork.dyn.perspektivbredband.net. [94.245.46.49]) by smtp.gmail.com with ESMTPSA id a17sm766769lfd.148.2020.09.18.12.48.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 18 Sep 2020 12:48:40 -0700 (PDT) From: "Uladzislau Rezki (Sony)" To: LKML , RCU , linux-mm@kvack.org, Andrew Morton , "Paul E . McKenney" Cc: Peter Zijlstra , Michal Hocko , Vlastimil Babka , Thomas Gleixner , "Theodore Y . Ts'o" , Joel Fernandes , Sebastian Andrzej Siewior , Uladzislau Rezki , Oleksiy Avramchenko Subject: [PATCH 3/4] rcu/tree: use __rcu_alloc_page_lockless() func. Date: Fri, 18 Sep 2020 21:48:16 +0200 Message-Id: <20200918194817.48921-4-urezki@gmail.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200918194817.48921-1-urezki@gmail.com> References: <20200918194817.48921-1-urezki@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Use a newly introduced __rcu_alloc_page_lockless() function directly in the k[v]free_rcu() path, a new pointer array can be obtained by demand, what reduces a memory footprint, does it without any delays and in time. Please note, we still keep the worker approach introduced earlier, because the lock-less page allocation uses a per-cpu-list cache that can be depleted, what is absolutely a normal behaviour. If so, the worker we have, by requesting a new page will also initiate an internal process that prefetches specified number of elements from the buddy allocator populating the "pcplist" by new fresh pages. A number of pre-fetched elements can be controlled via sysfs attribute. Please see the /proc/sys/vm/percpu_pagelist_fraction. Signed-off-by: Uladzislau Rezki (Sony) --- kernel/rcu/tree.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/kernel/rcu/tree.c b/kernel/rcu/tree.c index 4bfc46a1e9d1..d51209343029 100644 --- a/kernel/rcu/tree.c +++ b/kernel/rcu/tree.c @@ -3401,6 +3401,10 @@ kvfree_call_rcu_add_ptr_to_bulk(struct kfree_rcu_cpu *krcp, void *ptr) if (!krcp->bkvhead[idx] || krcp->bkvhead[idx]->nr_records == KVFREE_BULK_MAX_ENTR) { bnode = get_cached_bnode(krcp); + if (!bnode) + bnode = (struct kvfree_rcu_bulk_data *) + __rcu_alloc_page_lockless(); + /* Switch to emergency path. */ if (!bnode) return false; -- 2.20.1