Received: by 2002:a05:6a10:6d10:0:0:0:0 with SMTP id gq16csp860104pxb; Fri, 22 Apr 2022 12:50:41 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw1nYBFCazFeZFCJXqeimMWdRknupINWXMblSMRr9PVtnx0m+nnMoEftp/w2rFq4sLVV4bH X-Received: by 2002:a17:902:8ec2:b0:156:9d2c:9ec5 with SMTP id x2-20020a1709028ec200b001569d2c9ec5mr6032734plo.170.1650657041677; Fri, 22 Apr 2022 12:50:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650657041; cv=none; d=google.com; s=arc-20160816; b=rqcgB4YS4HKZ3kxk8y3dpfShXU/FQ4h6Zm4c9/fnmuxFyBBqG5mldG1pHZaBKaddia 9mOnyf2fLcnbVPbnbiPqAMCz+V9VYooEyUHFxbYT8ZeLCQLxk3II6YvjooepgXu/vCFX fO2smqdaN5lvtnBtnk7mwWUlq/VwUJWLPXhgZ6EYJJCA7UuAwRp/FDTUYzSwoIjvqZfI Wfg2rvJYWinIbCJgDfVdApbJK82blv/dInd+sVahtgxDHchABWp5DKPRUPIPDGCUnfoR sJqXWLJ80Dhje91B+W/2DN7IFCJkhAPaDFSecJkDAmDfFJK2oE12thCmfVquubeQ9lbC 9ATQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:message-id :mime-version:in-reply-to:references:cc:to:subject:from:date :dkim-signature; bh=lE0V3qjAS7CCi6fROk/XeSupX8dBuxp5diNFKdfJZzc=; b=ZZCWMOOEf6Mu7v6USc8ZCFzE+ha0T9cW470XhMl3GWOE24lBweItdvYR5Srabq7opn OqzO87l+EBz+QPuef3ImsfZJPj95LEOIIyt5kKWDWtKizCs9kwJI+9yfZJpuSkGX6BDM mQRmIGK3LXMnbqcyEj3aYZw41NjkkCpYNQl1TYwF4+7sHityJo0PHdHGi0scFZMHw2Jy goleq8oTlP97uAbgpc5nIV7rnVPyHTjfEbGWI37Qg7olW9zL2QkQ5BHaK0njYgFkmpuL 8AKdPzsHMtt0vSt1wPAzxufpSBRCzQvZ1HkyfOQLp5yjLHeadt4CO8875Ny7x39ERenj ruEg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=KbrsF8Fe; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1: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 lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id n186-20020a6327c3000000b0039cf4316714si9534905pgn.421.2022.04.22.12.50.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Apr 2022 12:50:41 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=KbrsF8Fe; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1: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: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 571D7203F73; Fri, 22 Apr 2022 11:52:39 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1442550AbiDUXdi (ORCPT + 99 others); Thu, 21 Apr 2022 19:33:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37386 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239963AbiDUXdh (ORCPT ); Thu, 21 Apr 2022 19:33:37 -0400 Received: from mail-pl1-x635.google.com (mail-pl1-x635.google.com [IPv6:2607:f8b0:4864:20::635]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 723393A19D; Thu, 21 Apr 2022 16:30:45 -0700 (PDT) Received: by mail-pl1-x635.google.com with SMTP id h12so3390617plf.12; Thu, 21 Apr 2022 16:30:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=date:from:subject:to:cc:references:in-reply-to:mime-version :message-id:content-transfer-encoding; bh=lE0V3qjAS7CCi6fROk/XeSupX8dBuxp5diNFKdfJZzc=; b=KbrsF8Fen3H4rDvpPByaGLqw8BH6O0NVgJ9U9mZVU8q7kEBaZC0YvNL8ZBmICxppS7 NlQbbRoJWy7Fc/nDZhwdWK6uOBL03/SwAute02SyiW/ofQzqduZftIwR4zCWzCOxyyiY OvtMjoQOU11M8gnHp4RATKflKdlU0qs8Aw+u7/gSQTQsaLL+qUZynwsQN7EKKHWLGg46 Wie4q4wg2XZJ+lWk0OoQsoNEehPlswUEfIXOtsuZIzN/Abmy1LKCWKTvP9BM4AXlv2PS 4sTU/seTA2grVXKQi85b8mp0tnPy1/Y8hv3JHJ69cywIJJ/esF4lsxgwktJV+c/TSZPs vQHA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:subject:to:cc:references:in-reply-to :mime-version:message-id:content-transfer-encoding; bh=lE0V3qjAS7CCi6fROk/XeSupX8dBuxp5diNFKdfJZzc=; b=afARTWlerELZ9KCbdPJDRoG+DbCyqpkbvcA1KSnOlKwmbqkUXaH8KBFoAFXCPFMV46 yBAmoerN4/32QmKy6X497STGHrDoAxrqMkkT0SNufbOf3q37awypc3vh9sMgXZpA8K5m 032VgjlXcqwOkGeFwhDa3wBOy/Dpja9oM2H8y6u287jBie9a/9HNlM+89OwlqNO+j1RT 6+BKy/PeTaRh1NLdYS+hwzqjwNvAGYhdlkaB3SyG78YOOEkm8wkqCcVcdUzLcSDMXBHp /XBydOb5cPKqYX8+d/Z1M2Nw9D6m6dfZemGQDHsRLO0P6o8yCu01cijkUjUY2q8yoFOc EoZw== X-Gm-Message-State: AOAM5316euwTVoBT7pbQSiZNoJM/+vLKbTCoH78seoj/qTZD3Zlis7Lg Kd50GZhEU06zEmvWXgpQMGA= X-Received: by 2002:a17:902:8644:b0:153:9f01:2090 with SMTP id y4-20020a170902864400b001539f012090mr1520080plt.101.1650583844918; Thu, 21 Apr 2022 16:30:44 -0700 (PDT) Received: from localhost (193-116-116-20.tpgi.com.au. [193.116.116.20]) by smtp.gmail.com with ESMTPSA id l18-20020a056a00141200b004f75395b2cesm207689pfu.150.2022.04.21.16.30.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Apr 2022 16:30:44 -0700 (PDT) Date: Fri, 22 Apr 2022 09:30:39 +1000 From: Nicholas Piggin Subject: Re: [PATCH v4 bpf 0/4] vmalloc: bpf: introduce VM_ALLOW_HUGE_VMAP To: Linus Torvalds Cc: "akpm@linux-foundation.org" , "ast@kernel.org" , "bp@alien8.de" , "bpf@vger.kernel.org" , "daniel@iogearbox.net" , "dborkman@redhat.com" , "edumazet@google.com" , "hch@infradead.org" , "hpa@zytor.com" , "imbrenda@linux.ibm.com" , Kernel Team , "linux-kernel@vger.kernel.org" , "linux-mm@kvack.org" , "mbenes@suse.cz" , "mcgrof@kernel.org" , "pmladek@suse.com" , "Edgecombe, Rick P" , Mike Rapoport , "song@kernel.org" , Song Liu References: <20220415164413.2727220-1-song@kernel.org> <4AD023F9-FBCE-4C7C-A049-9292491408AA@fb.com> <88eafc9220d134d72db9eb381114432e71903022.camel@intel.com> <1650511496.iys9nxdueb.astroid@bobo.none> <1650530694.evuxjgtju7.astroid@bobo.none> In-Reply-To: MIME-Version: 1.0 Message-Id: <1650582120.hf4z0mkw8v.astroid@bobo.none> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-1.7 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RDNS_NONE, SPF_HELO_NONE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Excerpts from Linus Torvalds's message of April 22, 2022 1:44 am: > On Thu, Apr 21, 2022 at 1:57 AM Nicholas Piggin wrote= : >> >> Those were (AFAIKS) all in arch code though. >=20 > No Nick, they really weren't. >=20 > The bpf issue with VM_FLUSH_RESET_PERMS means that all your arguments > are invalid, because this affected non-architecture code. VM_FLUSH_RESET_PERMS was because bpf uses the arch module allocation=20 code which was not capable of dealing with huge pages in the arch specific direct map manipulation stuff was unable to deal with it. An x86 bug. > So the bpf case had two independent issues: one was just bpf doing a > really bad job at making sure the executable mapping was sanely > initialized. >=20 > But the other was an actual bug in that hugepage case for vmalloc. >=20 > And that bug was an issue on power too. I missed it, which bug was that? >=20 > So your "this is purely an x86 issue" argument is simply wrong. > Because I'm very much looking at that power code that says "oh, > __module_alloc() needs more work". >=20 > Notice? No I don't notice. More work to support huge allocations for executable mappings, sure. But the arch's implementation explicitly does not support that yet. That doesn't make huge vmalloc broken! Ridiculous. It works fine. >=20 > Can these be fixed? Yes. But they can't be fixed by saying "oh, let's > disable it on x86". You did just effectively disable it on x86 though. And why can't it be reverted on x86 until it's fixed on x86?? > Although it's probably true that at that point, some of the issues > would no longer be nearly as noticeable. There really aren't all these "issues" you're imagining. They aren't noticable now, on power or s390, because they have non-buggy HAVE_ARCH_HUGE_VMALLOC implementations. If you're really going to insist on this will you apply this to fix=20 (some of) the performance regressions it introduced? Thanks, Nick diff --git a/mm/page_alloc.c b/mm/page_alloc.c index 6e5b4488a0c5..b555f17e84d5 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -8919,7 +8919,10 @@ void *__init alloc_large_system_hash(const char *tab= lename, table =3D memblock_alloc_raw(size, SMP_CACHE_BYTES); } else if (get_order(size) >=3D MAX_ORDER || hashdist) { - table =3D __vmalloc(size, gfp_flags); + if (IS_ENABLED(CONFIG_PPC) || IS_ENABLED(CONFIG_S390)) + table =3D vmalloc_huge(size, gfp_flags); + else + table =3D __vmalloc(size, gfp_flags); virt =3D true; if (table) huge =3D is_vm_area_hugepages(table);