Received: by 2002:a05:6602:2086:0:0:0:0 with SMTP id a6csp4464961ioa; Wed, 27 Apr 2022 04:35:25 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwdMeMdHRLebnYgKBAzcZKrpC/nHzD+0zA6vEIv0gme0f+hMAm23bOYlJxLJhhIH0PineDN X-Received: by 2002:a63:88c8:0:b0:3ab:1871:13b4 with SMTP id l191-20020a6388c8000000b003ab187113b4mr16264508pgd.85.1651059325529; Wed, 27 Apr 2022 04:35:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1651059325; cv=none; d=google.com; s=arc-20160816; b=oMMylDQIylZW4rm2EtXnzgaTjCEqDrUZoTrh/Hb9i4n4kfw10aJalbGPiuCoG5/OpF IX50GQO3TEa1pom4RuQ/l2jsyute8LB1ej/hQbwF+4uMO/UyQMdZYVX9JqFfkJ+Abbr2 /CCQ7QREGpPFNIDmTqmHUSOkbcUPKmf0ypM8NT2/z+1i5g6AWM3dOs+Bj2HNw5ssdDBJ Au3WoSu4w04MSfyiTGkcSaACFJ8h/uFYI+Y2bQjM15q4b6urzLn9CNyL3O8Ypb5fLQT5 jVRaosGBDyiIOt7ccPQ37KBWRWxskl6bFBh72FUbOqxePBu/lve09KQsvgPY7s4qAQYk e24w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature:dkim-signature; bh=nFAtxF/0wAb9NJnG/I53G5SBU7w/mpVy8mXh+S+TaHk=; b=rPXYUf0XQZqyV2cLeM+EARXF/sRJ6VNVjWG7ytXsn8SXOAJVhjwoAa6POTlhuhwEiB 0tLJvA2TGntmeHTOGSuMkZbGtYQTOsXZThIvhrZTta1JGF/h2Bxnc7hU8xIVVfCFeJi+ byngkNzBlpA4evw/m9Py2k1WcZXD7600c5l4XXMehFy4zOjcKlBumYZWMEDWimn1x+kN NKcY+PKpS3D5MEZJlYFFmTCS0ptQZBW7iAf++rKwYDNsmVfL/Rhue04d9px+tWENGevX MPyhvjlLediQvFZYwPDUYRouEunwh3uHxDgChIMAkmXRhq/H7Ic4AoveMYvdaZVhu8Te Ck9Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.cz header.s=susede2_rsa header.b=y5ZDC4wM; dkim=neutral (no key) header.i=@suse.cz header.s=susede2_ed25519; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id mw4-20020a17090b4d0400b001c680dc9e6asi6100693pjb.61.2022.04.27.04.35.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 27 Apr 2022 04:35:25 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.cz header.s=susede2_rsa header.b=y5ZDC4wM; dkim=neutral (no key) header.i=@suse.cz header.s=susede2_ed25519; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 65A0737EDC9; Wed, 27 Apr 2022 03:24:56 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1359342AbiD0INQ (ORCPT + 99 others); Wed, 27 Apr 2022 04:13:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39652 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1359339AbiD0INN (ORCPT ); Wed, 27 Apr 2022 04:13:13 -0400 Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B4694C2C for ; Wed, 27 Apr 2022 01:10:02 -0700 (PDT) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id 6EF761F380; Wed, 27 Apr 2022 08:10:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1651047001; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=nFAtxF/0wAb9NJnG/I53G5SBU7w/mpVy8mXh+S+TaHk=; b=y5ZDC4wMdeTmEh57cAh/YKO6iXiIANJC2QM2D9eruFvDF6ZLrJ94LtxcOUodpouV+Rgf/P 4HqT63bfPyWc6KM6Ty9u9xPRUC1/155gvdomkJL2uwp8Z66o3GR7spNb1NRha8qpkKlEo6 0dFndph8qFE+ppCUYqe0mJ/UOkTeM6Q= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1651047001; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=nFAtxF/0wAb9NJnG/I53G5SBU7w/mpVy8mXh+S+TaHk=; b=+wXKTGVjYGj2LnJDm3asEQsDfsIZlrUO62gro2/laJJH/151q6YFlVDlAjN+A2wwyzuZu1 Sjwn/vIlM2PZboCw== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 395091323E; Wed, 27 Apr 2022 08:10:01 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id AdxJDVn6aGIIPAAAMHmgww (envelope-from ); Wed, 27 Apr 2022 08:10:01 +0000 Message-ID: <5f47bb6b-d7f4-13fc-8d09-e80c9a5185ba@suse.cz> Date: Wed, 27 Apr 2022 10:10:00 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.7.0 Subject: Re: [PATCH v2 13/23] mm/slab: kmalloc: pass requests larger than order-1 page to page allocator Content-Language: en-US To: Hyeonggon Yoo <42.hyeyoo@gmail.com> 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 References: <20220414085727.643099-1-42.hyeyoo@gmail.com> <20220414085727.643099-14-42.hyeyoo@gmail.com> From: Vlastimil Babka In-Reply-To: <20220414085727.643099-14-42.hyeyoo@gmail.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-3.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,NICE_REPLY_A,RDNS_NONE,SPF_HELO_NONE autolearn=unavailable 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 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 > > - 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. > + > if (!s) > continue; >