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 1E29EC43334 for ; Wed, 6 Jul 2022 18:36:25 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 96AC46B0072; Wed, 6 Jul 2022 14:36:24 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 91A3A6B0073; Wed, 6 Jul 2022 14:36:24 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 7E23D6B0074; Wed, 6 Jul 2022 14:36:24 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id 705EC6B0072 for ; Wed, 6 Jul 2022 14:36:24 -0400 (EDT) Received: from smtpin04.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id 411F135FD5 for ; Wed, 6 Jul 2022 18:36:24 +0000 (UTC) X-FDA: 79657530288.04.D858B49 Received: from mail-pg1-f180.google.com (mail-pg1-f180.google.com [209.85.215.180]) by imf01.hostedemail.com (Postfix) with ESMTP id DFB5840016 for ; Wed, 6 Jul 2022 18:36:23 +0000 (UTC) Received: by mail-pg1-f180.google.com with SMTP id g4so14693289pgc.1 for ; Wed, 06 Jul 2022 11:36:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=EssyX2zYH+6lemVwgoSPIPUohN3bYwLSTLZWWFh3bMc=; b=nAv9iKvi+Z2hezH3BVj1RqYgFRSH8GlHcGNO822p+9reNEjxidqOXRh4f6EfR+S6cH L8UGY2JD9C4QMyjbZZvt83sQkndtrjynVrhdi3Lcb4iSs7zt/yN0k6gXW6SIT0U3SsgW F22M9TlNsNPlJR5tUDifYCWXuiV2o5eqqBMKtH0kbbi+rCkzasPmgNkib+CeBytZyW73 cccFzES5PEFAaHJrQmsDsWTL1M4CjSYPs6moGo57w/Azo7yiCw7pxz112juHCayfm59b +jYO9jwsd3rB75cFytkLAHIm5T1csPIx721SB8qfurP86yki1LE4bquKeK5/hyfw7JGO KZTQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=EssyX2zYH+6lemVwgoSPIPUohN3bYwLSTLZWWFh3bMc=; b=t2Q9ThhSQ4m1+S6If/oYQIEHNrDTNn1/b9ngN6W0J/ZLFsnUjhdGtRokQrVvjGlduT dNfd7iIm5XN+VrkQ8MFk38GhyOMHunbFC+iN6HpAmenRtzKZzHhcyQ4je18ytl6Upxza FMfFt+FZV3+k0lkV467e7EAYBBh34lCNpdLd/yHJEEgDvgRlv/NJ5nAdlQ+aW9Doo7X3 uNUGjOXVlXoKIJRAzcwDhDOWIRjVyPCuiGKpUspYhvMs6hrx91dUg9ntCetQiW/fN07q MHccDJ1+pWEXuOqEVqvNGy6Io+joUt+7YySCViaAkNIg7S4ZUJqqkFt1gYSrDZRJJS5y yfow== X-Gm-Message-State: AJIora95RldPma7d+fvz3hGHdAchAF7Ow72FCy8UHpK4tQgCvcNjhrEM C4Ndv8O7p0nmK2Ul8rQJPe8= X-Google-Smtp-Source: AGRyM1tGcz+2urZQJrC7c1PtUuqwXYtYj2W3BgNsAJuqpY2EfLA6pVsuusr2F2jwof+K6V0/mojVdw== X-Received: by 2002:a63:e446:0:b0:412:937b:5a3c with SMTP id i6-20020a63e446000000b00412937b5a3cmr4857134pgk.316.1657132582886; Wed, 06 Jul 2022 11:36:22 -0700 (PDT) Received: from MacBook-Pro-3.local ([2620:10d:c090:500::2:8597]) by smtp.gmail.com with ESMTPSA id y9-20020a056a001c8900b005254535a2cfsm24712822pfw.136.2022.07.06.11.36.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Jul 2022 11:36:22 -0700 (PDT) Date: Wed, 6 Jul 2022 11:36:19 -0700 From: Alexei Starovoitov To: Matthew Wilcox Cc: Christoph Hellwig , davem@davemloft.net, daniel@iogearbox.net, andrii@kernel.org, tj@kernel.org, kafai@fb.com, bpf@vger.kernel.org, kernel-team@fb.com, linux-mm@kvack.org, Christoph Lameter , Pekka Enberg , David Rientjes , Joonsoo Kim , Andrew Morton , Vlastimil Babka Subject: Re: [PATCH bpf-next 0/5] bpf: BPF specific memory allocator. Message-ID: <20220706183619.3mmtsyi72c6ss5tu@MacBook-Pro-3.local> References: <20220623003230.37497-1-alexei.starovoitov@gmail.com> <20220706175034.y4hw5gfbswxya36z@MacBook-Pro-3.local> <20220706180525.ozkxnbifgd4vzxym@MacBook-Pro-3.local.dhcp.thefacebook.com> <20220706182635.ccgt6zcr6bkd3rjc@MacBook-Pro-3.local> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1657132583; a=rsa-sha256; cv=none; b=5pc/bjvpYGijnltXhQi07XiMtE3t6T8Im114EnRCVsOhI8htpPSGEsP/e3woiZqWgW424w +u/SYtkjNipRs9MPtVx8d87ZGBOzD0vrIRO/4Y2JwhjjmqVHU9OTpDTAxuA/7eNoNQyWg3 C6Pgn5Np1pkK0XgZm6KoI54thnKqYv0= ARC-Authentication-Results: i=1; imf01.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=nAv9iKvi; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf01.hostedemail.com: domain of alexei.starovoitov@gmail.com designates 209.85.215.180 as permitted sender) smtp.mailfrom=alexei.starovoitov@gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1657132583; 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=EssyX2zYH+6lemVwgoSPIPUohN3bYwLSTLZWWFh3bMc=; b=gJDJicePuNOw+oVtB2xxK/6dKaivBCTJNVvSz4dGIdtVWvp/+wny5/N2tABi0c4R6GjsMu MvL1WIFGN9FL55/SLKA7q4MD49eJrdewz7Hv7wEfLddtInQ4UmpvyZdMHxOfGY2r17II2H pv/A84WcpfdnlfBHMeOqbhOLyXJ9Rfc= Authentication-Results: imf01.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=nAv9iKvi; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf01.hostedemail.com: domain of alexei.starovoitov@gmail.com designates 209.85.215.180 as permitted sender) smtp.mailfrom=alexei.starovoitov@gmail.com X-Stat-Signature: pincd5dyant763zrt6pt539iuq5y9xp4 X-Rspamd-Queue-Id: DFB5840016 X-Rspamd-Server: rspam05 X-Rspam-User: X-HE-Tag: 1657132583-812219 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, Jul 06, 2022 at 07:31:34PM +0100, Matthew Wilcox wrote: > On Wed, Jul 06, 2022 at 11:26:35AM -0700, Alexei Starovoitov wrote: > > On Wed, Jul 06, 2022 at 07:21:29PM +0100, Matthew Wilcox wrote: > > > On Wed, Jul 06, 2022 at 11:05:25AM -0700, Alexei Starovoitov wrote: > > > > On Wed, Jul 06, 2022 at 06:55:36PM +0100, Matthew Wilcox wrote: > > > > > For example, I assume that a BPF program > > > > > has a fairly tight limit on how much memory it can cause to be allocated. > > > > > Right? > > > > > > > > No. It's constrained by memcg limits only. It can allocate gigabytes. > > > > > > I'm confused. A BPF program is limited to executing 4096 insns and > > > using a maximum of 512 bytes of stack space, but it can allocate an > > > unlimited amount of heap? That seems wrong. > > > > 4k insn limit was lifted years ago. > > You might want to update the documentation. > https://www.kernel.org/doc/html/latest/bpf/bpf_design_QA.html > still says 4096. No. Please read what you're quoting first. > > bpf progs are pretty close to be at parity with kernel modules. > > Except that they are safe, portable, and users have full visibility into them. > > It's not a blob of bytes unlike .ko. > > It doesn't seem unreasonable to expect them to behave like kernel > modules, then. If they want to allocate memory in NMI context, then > they should get to preallocate it before they go into NMI context. You're still missing 'any context' part from the previous email.