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 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 03EFCC04AA5 for ; Thu, 25 Aug 2022 00:14:13 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 95FAC940007; Wed, 24 Aug 2022 20:14:12 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 90E7E6B0075; Wed, 24 Aug 2022 20:14:12 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 7B0B8940007; Wed, 24 Aug 2022 20:14:12 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id 6CB8A6B0074 for ; Wed, 24 Aug 2022 20:14:12 -0400 (EDT) Received: from smtpin12.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id 279161C6630 for ; Thu, 25 Aug 2022 00:14:12 +0000 (UTC) X-FDA: 79836192744.12.22B7AC1 Received: from mail-ed1-f54.google.com (mail-ed1-f54.google.com [209.85.208.54]) by imf26.hostedemail.com (Postfix) with ESMTP id C37EB14004D for ; Thu, 25 Aug 2022 00:14:11 +0000 (UTC) Received: by mail-ed1-f54.google.com with SMTP id t5so24053239edc.11 for ; Wed, 24 Aug 2022 17:14:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc; bh=1cZ5fH+Ewc2LGXwwIEQtYhVySKyjevRHiiFcPdgiin0=; b=IjZHKkFE+Y/xsGwnPIGv8XoyPktr8AHkmYM7kqDu3mLooyGu/LYG+vFKefWrUkL2uq 7H7hVpwmCJw60ETvk+SXBnyK63VcGoOw/ZaAQC5s6p5HsU6iYizUcubV27rBKZ5gi+Zh J1lMtxonWXBqQ4SzXs7H9TqNGgpr5UnmFTItXNNqdx8H1qo8oF0k9MFlI61FZ20gysxg 7/cu5ESsK5PS56/v97qssqxIjDiq5poHn3IVkUEk9elsdXsAzFR1IorUJLJY0Wk9ROtf ErNCPK87dFowrJf88ZkEnVlSnSNilsJkMpXD+wPvElqAKtXJiZD2kXAUVJ1inllp2oZq sZxw== 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; bh=1cZ5fH+Ewc2LGXwwIEQtYhVySKyjevRHiiFcPdgiin0=; b=I/23fM7m/nFJQs+kTb9eKmlV3+atsDDzV0OHTQ7Y2Ro7IQ2gshFx+htV5KEiMV43aW Ro/y05KyihnDMsQsOLcYptJMBCrDIYPZr/4QVXYxQ1ne9fxs2EFSyRNLl5WRx/cQpcnR XMbyM7ydmRC4z9itkV90OR7P+eVSG6iVma8v3KgRQCfPGn7mTqvj21zIQmVeUoKaIqcK OwWuCwxVnBskCGV4s/4NYM8UYdk7F5j2jxKH5qDYjV3ghdmqxCf/bXAjO8HQ1WXYwUXY 7EKsXdaRcH2j1xb3axtfhCFJPK+Qz5Q4NEOj/xT0Zy14dgB/Ggjfv76g5DU2dUQ6WQJw EAoQ== X-Gm-Message-State: ACgBeo0eJKJJ3n1BuUjkRP9/LBlRbdEEim0DJbsQtRBSXQM42hVqTloF 7UWrv/1kySD/OrILH/qL7mV8y2wMMQJSKkQw6naqKyTcNac= X-Google-Smtp-Source: AA6agR7q1oY8UZE2gzyzK0MtljOQHFUAJdlTh63fIw5iHtU0la2yum1s/3oQOfGvI8spUSibYKcrFzkg3pPoopiigwQ= X-Received: by 2002:a05:6402:28cb:b0:43b:c6d7:ef92 with SMTP id ef11-20020a05640228cb00b0043bc6d7ef92mr1106837edb.333.1661386450623; Wed, 24 Aug 2022 17:14:10 -0700 (PDT) MIME-Version: 1.0 References: <20220819214232.18784-1-alexei.starovoitov@gmail.com> <20220819214232.18784-10-alexei.starovoitov@gmail.com> In-Reply-To: From: Alexei Starovoitov Date: Wed, 24 Aug 2022 17:13:59 -0700 Message-ID: Subject: Re: [PATCH v3 bpf-next 09/15] bpf: Batch call_rcu callbacks instead of SLAB_TYPESAFE_BY_RCU. To: Kumar Kartikeya Dwivedi Cc: "David S. Miller" , Daniel Borkmann , Andrii Nakryiko , Tejun Heo , Delyan Kratunov , linux-mm , bpf , Kernel Team , Joel Fernandes Content-Type: text/plain; charset="UTF-8" ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1661386451; a=rsa-sha256; cv=none; b=vRWATVUh6e5rpRP7vbT82GR7VSidldBs0fn4vEusyfJkD0QXdF+7xpgwv13s1S8Gg5qGNc 6VL77LCqwUprT9efHK7Aeek/PsyhtpCNGU2cZ5XUwdptKsLq1EiKUXQiLKBCV7cE5N3phi 8I6i+h9B9L4PSXyUsZ3C3izGKeaVIcw= ARC-Authentication-Results: i=1; imf26.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=IjZHKkFE; spf=pass (imf26.hostedemail.com: domain of alexei.starovoitov@gmail.com designates 209.85.208.54 as permitted sender) smtp.mailfrom=alexei.starovoitov@gmail.com; dmarc=pass (policy=none) header.from=gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1661386451; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=1cZ5fH+Ewc2LGXwwIEQtYhVySKyjevRHiiFcPdgiin0=; b=DUZSISlJ70s9RHLj75u9bPBBD1tlsjoCdgcJKQLn1VPuHlI55qvW1I/jtsAKp9bdxhWint hO1iZpnLu5Sr0inWLZDatrMw+xbPdAq3ApBh0mo1DVol+DJM3Vh4i+NYAQV9BmsvoFfjvH pjRXV+jRBT187lTNDGYhatlaNiOFCF8= X-Rspam-User: X-Stat-Signature: b8na6er4tgpw1koj75qsdyceixyfpci5 X-Rspamd-Queue-Id: C37EB14004D Authentication-Results: imf26.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=IjZHKkFE; spf=pass (imf26.hostedemail.com: domain of alexei.starovoitov@gmail.com designates 209.85.208.54 as permitted sender) smtp.mailfrom=alexei.starovoitov@gmail.com; dmarc=pass (policy=none) header.from=gmail.com X-Rspamd-Server: rspam01 X-HE-Tag: 1661386451-848011 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: On Wed, Aug 24, 2022 at 12:59 PM Kumar Kartikeya Dwivedi wrote: > > On Fri, 19 Aug 2022 at 23:43, Alexei Starovoitov > wrote: > > > > From: Alexei Starovoitov > > > > SLAB_TYPESAFE_BY_RCU makes kmem_caches non mergeable and slows down > > kmem_cache_destroy. All bpf_mem_cache are safe to share across different maps > > and programs. Convert SLAB_TYPESAFE_BY_RCU to batched call_rcu. This change > > solves the memory consumption issue, avoids kmem_cache_destroy latency and > > keeps bpf hash map performance the same. > > > > Signed-off-by: Alexei Starovoitov > > Makes sense, there was a call_rcu_lazy work from Joel (CCed) on doing > this batching using a timer + max batch count instead, I wonder if > that fits our use case and could be useful in the future when it is > merged? > > https://lore.kernel.org/rcu/20220713213237.1596225-2-joel@joelfernandes.org Thanks for the pointer. It looks orthogonal. timer based call_rcu is for power savings. I'm not sure how it would help here. Probably wouldn't hurt. But explicit waiting_for_gp list is necessary here, because two later patches (sleepable support and per-cpu rcu-safe freeing) are relying on this patch.