Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp3570910iob; Sun, 1 May 2022 23:07:42 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzIuejH9VTKRgiyoFbSyJs7DFpB8xnJPgtJj5JChjt6inPmclLJdvbUIJsGXs1dtnrvpSmv X-Received: by 2002:a19:ad46:0:b0:46b:b1a4:ffd5 with SMTP id s6-20020a19ad46000000b0046bb1a4ffd5mr7756363lfd.103.1651471662525; Sun, 01 May 2022 23:07:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1651471662; cv=none; d=google.com; s=arc-20160816; b=FLAHeMRlNO+1j4cgvzp2uxIPKh/a5Q7Bxq4ZzoYi4kbAf7ZNkK1fP1lRdnngUwoX/o eec5UoCEtu+AHitlnd7roTMuAC2vqO6wwGU+rifBzOFr3XJrcfeGzwWAyYULroAWu9rI aUtXaJC8PflJ537pICfXJUp/1KLydH+tLRvjYrsOc74Sr724Qz4cIwqt9h4DS9ry4eQw 92nHJ50XeJ0uRw1S1MQOPXfdtH/3GAv0CBIKlqoifyZqtAR7fYz3oSQ6NdtE7DCNmr/d NxFH0+qmfwG8K6TvYwGTqD1kGPx3qP1QjNqcv+OLSIn1Nbn96AssFUMx0oWyKgDdRPgb SKdw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=Lt3kuWafWjkHObNCFDZ+lBWwcdfVn/Z+mxQOXhxUeu4=; b=zsSLOnqz7ENimsn8J4yRCFweq7i5WJx/wg18yny7KGT/OymASR3GyhswLqmVBkVW/X l6y6Ml84EW4Dz4ca+Cm2n/c6W8IysuOAUZqgtpE+xcy2xKmZILY6JbOoEE1OP9Huyker Ol9V/nkdZ8hzQVygnrH2NkCImWQljM0RABL7BTGJj3rz2rsjRl+JBwXMJD5NRX8OCkvB AHZqHtip47RE28wvBP9wgprLTlRHg2uJKpitGJrzdEk645fx8t2jtcPhA6GLgP1AAwTK u8rhVKfFW7z6pWvjy5kkNUHMFc5jPTaU8sG2u1FYAuORUr2RR+ytUN4mFShVwbP1PCNz 6zOg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=HbL5cUVw; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id s12-20020a2eb8cc000000b0024f550351a7si3865334ljp.285.2022.05.01.23.07.16; Sun, 01 May 2022 23:07:42 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=HbL5cUVw; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S236672AbiD3LyS (ORCPT + 99 others); Sat, 30 Apr 2022 07:54:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53386 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241665AbiD3Lx4 (ORCPT ); Sat, 30 Apr 2022 07:53:56 -0400 Received: from mail-pj1-x102a.google.com (mail-pj1-x102a.google.com [IPv6:2607:f8b0:4864:20::102a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CDA81183B6 for ; Sat, 30 Apr 2022 04:50:34 -0700 (PDT) Received: by mail-pj1-x102a.google.com with SMTP id e24so9169406pjt.2 for ; Sat, 30 Apr 2022 04:50:34 -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:user-agent; bh=Lt3kuWafWjkHObNCFDZ+lBWwcdfVn/Z+mxQOXhxUeu4=; b=HbL5cUVwwiqUAl9N5LPUP5WdnwClowGeLSRI7zzPqMzBFMcLs3GwOVufjwlQDwzApN RRmdMPmBNr92Qxn7BcmZrNAU46ogXz3lTtFOPKEng1n4jhbfqxd3m5nzDu87RzIcTmC4 hp11otctlfZ1Q0LYyLe6pIg962H7Nl7FixeS7lKc/ydB0epPrmiyRk/aVANLjBxTlw7M /szdmk7ks9TOakYMblDX4MMfJaMiB7PWLkECzanHZfEZakU8UarE9nGfULWgUi18m8W/ KVRsNxFz3JroMgXmuxiD3XLGDrWNm7OUuaDw75ZKjWwQXO0s9f/J4j4oa+WEkfWzGyR8 xc6g== 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:user-agent; bh=Lt3kuWafWjkHObNCFDZ+lBWwcdfVn/Z+mxQOXhxUeu4=; b=o7Bc9PYX7RRNBWYHZAJFFYd/VXGs6yeZpD0xc0sATWc3SYfdVY5FbpGwraCd+wKWFN Q136kS44bNtTK8tlcwLH2FeAVwob14rg3ZqG67K4nriO5vaofPcmrmLijP98p9pIYenO hWJYK7UWctyL1/MMdoVZ5QdE4jvXwFW4eXRYVRcUQWZQW9mwsbrERfJD8JBi6J0kwHg3 iOPbyflw7RFEfzR3fN/TPC/tXhoERHqzaW5qCExwc8nmay0bQR8IHLCzPljuhwejpkru KreyEx5yyGJHoJilXLRa31gJFx74lJkRQBeOdJS5heXKS+05G+iQB/3lSVROmvm2MS2g fIDA== X-Gm-Message-State: AOAM5309/ODlmTL/SWqPfYoVgXKPbnPHNHmJFPn7emQ+Q3u5CAwdYGzM gjJxSWVUQSA9cPWnT6OSXro= X-Received: by 2002:a17:90b:4b4b:b0:1ca:bfdb:edce with SMTP id mi11-20020a17090b4b4b00b001cabfdbedcemr8791309pjb.85.1651319434180; Sat, 30 Apr 2022 04:50:34 -0700 (PDT) Received: from ip-172-31-27-201.ap-northeast-1.compute.internal (ec2-18-183-95-104.ap-northeast-1.compute.amazonaws.com. [18.183.95.104]) by smtp.gmail.com with ESMTPSA id b6-20020a17090a6ac600b001dbf2aac185sm5956570pjm.1.2022.04.30.04.50.31 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sat, 30 Apr 2022 04:50:33 -0700 (PDT) Date: Sat, 30 Apr 2022 11:50:28 +0000 From: Hyeonggon Yoo <42.hyeyoo@gmail.com> To: Vlastimil Babka Cc: Marco Elver , Matthew WilCox , Christoph Lameter , Pekka Enberg , David Rientjes , Joonsoo Kim , Andrew Morton , Roman Gushchin , linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v2 13/23] mm/slab: kmalloc: pass requests larger than order-1 page to page allocator Message-ID: <20220430115027.GC24925@ip-172-31-27-201.ap-northeast-1.compute.internal> References: <20220414085727.643099-1-42.hyeyoo@gmail.com> <20220414085727.643099-14-42.hyeyoo@gmail.com> <5f47bb6b-d7f4-13fc-8d09-e80c9a5185ba@suse.cz> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <5f47bb6b-d7f4-13fc-8d09-e80c9a5185ba@suse.cz> User-Agent: Mutt/1.5.21 (2010-09-15) X-Spam-Status: No, score=-0.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,HK_RANDOM_ENVFROM, HK_RANDOM_FROM,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS 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 On Wed, Apr 27, 2022 at 10:10:00AM +0200, Vlastimil Babka wrote: > On 4/14/22 10:57, Hyeonggon Yoo wrote: > > There is not much benefit for serving large objects in kmalloc(). > > Let's pass large requests to page allocator like SLUB for better > > maintenance of common code. > > > > Signed-off-by: Hyeonggon Yoo <42.hyeyoo@gmail.com> > > Reviewed-by: Vlastimil Babka > > Some nits: > > > @@ -3607,15 +3607,25 @@ void kmem_cache_free_bulk(struct kmem_cache *orig_s, size_t size, void **p) > > { > > struct kmem_cache *s; > > size_t i; > > + struct folio *folio; > > > > local_irq_disable(); > > for (i = 0; i < size; i++) { > > void *objp = p[i]; > > folio can be declared here > could probably move 's' too, and 'i' to the for () thanks to gnu11 > Right! > > > > - if (!orig_s) /* called via kfree_bulk */ > > - s = virt_to_cache(objp); > > - else > > + if (!orig_s) { > > + folio = virt_to_folio(objp); > > + /* called via kfree_bulk */ > > + if (!folio_test_slab(folio)) { > > + local_irq_enable(); > > + free_large_kmalloc(folio, objp); > > + local_irq_disable(); > > + continue; > > + } > > + s = folio_slab(folio)->slab_cache; > > + } else > > s = cache_from_obj(orig_s, objp); > > This should now use { } brackets per kernel style. > Yes. will do both in v3. > > + > > if (!s) > > continue; > >