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 43102C04AA5 for ; Thu, 25 Aug 2022 00:16:58 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id BD18D940007; Wed, 24 Aug 2022 20:16:57 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id B33AB6B0075; Wed, 24 Aug 2022 20:16:57 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 9AD77940007; Wed, 24 Aug 2022 20:16:57 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id 84FFF6B0074 for ; Wed, 24 Aug 2022 20:16:57 -0400 (EDT) Received: from smtpin11.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id 58F1C12049E for ; Thu, 25 Aug 2022 00:16:57 +0000 (UTC) X-FDA: 79836199674.11.BF8B408 Received: from mail-ej1-f46.google.com (mail-ej1-f46.google.com [209.85.218.46]) by imf14.hostedemail.com (Postfix) with ESMTP id 1228A10001E for ; Thu, 25 Aug 2022 00:16:56 +0000 (UTC) Received: by mail-ej1-f46.google.com with SMTP id n7so18354791ejh.2 for ; Wed, 24 Aug 2022 17:16:56 -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=kCz09irjxY9YaHQep0oAlZ3lBrB3BblbrjYoXYiA4aY=; b=ITbrRwY7USYG3/TGHrty44UPt9sJc4odl//myOMocK1xJGvsAMvsXabrPxdbchTVJW Drqdm2QLQaNhT/+vSg8GFN/+xL2L25YHh79/r0gwjea7oqeWQ+e+BhtmynqcaBvAQega 4n1MnhZyhXIf8DT7GPr7bCe5Jh2IkYUf3e9QSgoYe8O60ItcXBGQWCveO9AH75OY5lcA S/+7Q0EQOQBU14xoVYqWyzhsf+kDKuLVmHHu/IZEKkG9F7ELdDZ3XybAmyXsD58MHoVL 2CiBVXTK1CHg40hcWhAXD7rAKV/Gz6ZbyIi46HrSMoHSgjjLtjC2t62eQx08HIUejDqU GLCA== 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=kCz09irjxY9YaHQep0oAlZ3lBrB3BblbrjYoXYiA4aY=; b=sIhsVLQiYj/IcxYkrVdtsyeIjz+Vzwr3pnmvu0q5FmZyP1pgsxmVculm1FLF/8ivTS HG6IkR63zeBQGiyx1RNP6iafsIVnCuj6Hj7bZvrY2UpT0A8S+K8F3Rcg8p39Gba/bWEF zrEqiDOeX5k3DOX4GM+LjI3fD1BfxkyrnNvtFpZoTLSuwlgBOv1nU+3I/PZ024H5eJoa 4bU7mrluYVC3dhu2K92HgZa3gcAPxbJHJVofQ+zLmnfR9s7Z/tGvQXdu/AtgK/O0/Ui3 cXai3t2BJNrfjtwSJlBWiAxALW4912iGE9osXUthE8O5liIOZqGuBSPEENKFSCfI2ChY cC5Q== X-Gm-Message-State: ACgBeo1eh/lgWZo9JO77Hn0M6FAvPjwLvAZdJhk7SOdrWlOoP1QmDE6A Q/6N0+saxZvbia+n5vhE3OtDbcF0M7HRw6rzpJg= X-Google-Smtp-Source: AA6agR4Rw4qAYL9MLvTCk4zyY6F3vqn5Bp8OXH4zlCs0HCUoiTtpKCAlszjhS6lpgMaSdHHBKnB9sOE5j7WHkba0RlE= X-Received: by 2002:a17:906:3a15:b0:73d:80bf:542c with SMTP id z21-20020a1709063a1500b0073d80bf542cmr808205eje.633.1661386615832; Wed, 24 Aug 2022 17:16:55 -0700 (PDT) MIME-Version: 1.0 References: <20220819214232.18784-1-alexei.starovoitov@gmail.com> In-Reply-To: From: Alexei Starovoitov Date: Wed, 24 Aug 2022 17:16:44 -0700 Message-ID: Subject: Re: [PATCH v3 bpf-next 00/15] bpf: BPF specific memory allocator. To: Kumar Kartikeya Dwivedi Cc: "David S. Miller" , Daniel Borkmann , Andrii Nakryiko , Tejun Heo , Delyan Kratunov , linux-mm , bpf , Kernel Team Content-Type: text/plain; charset="UTF-8" ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1661386617; 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=kCz09irjxY9YaHQep0oAlZ3lBrB3BblbrjYoXYiA4aY=; b=o/SEMeO2253oIn+4DFpS18UWBoZKFylNN/XkE7hs2pk3deJNv6T/WIpWqEnYUsPGgxG9OA 352Tv0eCZYS4ui0w57lq99pRyjL3e/lbi5sblRynhg2u9I9+/83yMxUDktdsRnzg7UmCLv pj1KcHtWe22zi1Wi0cDkxWLRBMohJwU= ARC-Authentication-Results: i=1; imf14.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=ITbrRwY7; spf=pass (imf14.hostedemail.com: domain of alexei.starovoitov@gmail.com designates 209.85.218.46 as permitted sender) smtp.mailfrom=alexei.starovoitov@gmail.com; dmarc=pass (policy=none) header.from=gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1661386617; a=rsa-sha256; cv=none; b=w2r98KN+9VFWIQcIH292MamM6CCMntUqsFNHHcV9jb/3wIAG12GoOTCh82dO6eHRSNgpSi u9ZGwUkbRFag5OgTOBrbSW6mQ/1s3kzeeL/xbTRWSxpjKuY00aa63BO8aWxD08KaoCFE0X op+KA668yIBjBm9M374oY8HJNp0JCSE= X-Rspamd-Queue-Id: 1228A10001E Authentication-Results: imf14.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=ITbrRwY7; spf=pass (imf14.hostedemail.com: domain of alexei.starovoitov@gmail.com designates 209.85.218.46 as permitted sender) smtp.mailfrom=alexei.starovoitov@gmail.com; dmarc=pass (policy=none) header.from=gmail.com X-Rspam-User: X-Rspamd-Server: rspam11 X-Stat-Signature: s5ibdgojzm6ypx7qufzw5m4kky7j78o1 X-HE-Tag: 1661386616-405368 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 1:03 PM Kumar Kartikeya Dwivedi wrote: > > On Fri, 19 Aug 2022 at 23:42, Alexei Starovoitov > wrote: > > > > From: Alexei Starovoitov > > > > Introduce any context BPF specific memory allocator. > > > > Tracing BPF programs can attach to kprobe and fentry. Hence they > > run in unknown context where calling plain kmalloc() might not be safe. > > Front-end kmalloc() with per-cpu cache of free elements. > > Refill this cache asynchronously from irq_work. > > > > Major achievements enabled by bpf_mem_alloc: > > - Dynamically allocated hash maps used to be 10 times slower than fully preallocated. > > With bpf_mem_alloc and subsequent optimizations the speed of dynamic maps is equal to full prealloc. > > - Tracing bpf programs can use dynamically allocated hash maps. > > Potentially saving lots of memory. Typical hash map is sparsely populated. > > - Sleepable bpf programs can used dynamically allocated hash maps. > > > > From my side, for the whole series: > Acked-by: Kumar Kartikeya Dwivedi Thanks a bunch for all the suggestions. Especially for ideas that led to rewrite of patch 1. It looks much simpler now. I've missed #include in the patch 1. In the respin I'm going to keep your Ack if you don't mind. Thanks!