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 X-Spam-Level: X-Spam-Status: No, score=-0.6 required=3.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 37CB5C54FCC for ; Tue, 21 Apr 2020 14:36:23 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id F117720656 for ; Tue, 21 Apr 2020 14:36:22 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="uJ7surby" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org F117720656 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 9FB9D8E001E; Tue, 21 Apr 2020 10:36:22 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 9AAD78E0003; Tue, 21 Apr 2020 10:36:22 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 872EA8E001E; Tue, 21 Apr 2020 10:36:22 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0243.hostedemail.com [216.40.44.243]) by kanga.kvack.org (Postfix) with ESMTP id 6D8278E0003 for ; Tue, 21 Apr 2020 10:36:22 -0400 (EDT) Received: from smtpin21.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id 267CE4DBC for ; Tue, 21 Apr 2020 14:36:22 +0000 (UTC) X-FDA: 76732112604.21.patch40_71c651c693d08 X-HE-Tag: patch40_71c651c693d08 X-Filterd-Recvd-Size: 3486 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) by imf46.hostedemail.com (Postfix) with ESMTP for ; Tue, 21 Apr 2020 14:36:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=In-Reply-To:Content-Transfer-Encoding :Content-Type:MIME-Version:References:Message-ID:Subject:Cc:To:From:Date: Sender:Reply-To:Content-ID:Content-Description; bh=zVp/6Iwlp51D7w2qi9slWnmoKigDIMLGJ/B49YP5gsI=; b=uJ7surbye+bGQdio6RgN+YbBgF TMGGpWImp8g5VjI4hQ68YYOFDSa8ru+V9kHISN8XytZoTh6t0/AZrwFvMwLsXGW26OGgva4bTmJ4k kQiqJ6KkTFUIpDu8YtlfW5KEy0vC4LI8FWWSLI4cDJkrFN7O5Fr8ZC7h+ub9k878w03+DtPEHP+oO I56VYD+Fp0oX8uzyBuc1ksLPyrLwdSMHXIzSeZIZtzD2lMBqyaWXtbMm4x+HT0HA/wy++0XJhcHul lq4dv/7IMNq2BcJV6D2ubORG6y/7ICjWvWHPThwvHbfCEvE8nnqh2AWvuk+WAIhT+V4hlyJKl8i6K vS2vcBeg==; Received: from willy by bombadil.infradead.org with local (Exim 4.92.3 #3 (Red Hat Linux)) id 1jQu0P-0004Tu-Mu; Tue, 21 Apr 2020 14:36:09 +0000 Date: Tue, 21 Apr 2020 07:36:09 -0700 From: Matthew Wilcox To: =?utf-8?B?6LW15Yab5aWO?= Cc: Christoph Lameter , Pekka Enberg , David Rientjes , Joonsoo Kim , Andrew Morton , linux-mm@kvack.org, linux-kernel@vger.kernel.org, opensource.kernel@vivo.com Subject: Re: Re: [PATCH V2] kmalloc_index optimization(code size & runtime stable) Message-ID: <20200421143609.GM5820@bombadil.infradead.org> References: <20200421111849.GL5820@bombadil.infradead.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: Content-Transfer-Encoding: quoted-printable 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 Tue, Apr 21, 2020 at 07:55:03PM +0800, =E8=B5=B5=E5=86=9B=E5=A5=8E wro= te: > Sure, i just received some kbuild compiler error mails and prompt me to= do something?=20 > I don`t know why this happened, so i update the patch again. Don't. The patch has been NACKed, so there's no need to post a v2. If you want to do something useful, how about looking at the effect of adding different slab sizes? There's a fairly common pattern of allocating things which are a power of two + a header. So it may make sense to have kmalloc caches of 320 (256 + 64), 576 (512 + 64) and 1088 (1024 + 64). I use 64 here as that's the size of a cacheline, so we won't get false sharing between users. This could save a fair quantity of memory; today if you allocate 512 + 8 bytes, it will round up to 1024. So we'll get 4 allocations per 4kB page, but with a 576-byte slab, we'd get 7 allocations per 4kB page. Of course, if there aren't a lot of users which allocate memory in this range, then it'll be a waste of memory. On my laptop, it seems like there might be a decent amount of allocations in the right range: kmalloc-2k 3881 4384 2048 16 8 : tunables 0 0 = 0 : sla bdata 274 274 0 kmalloc-1k 6488 7056 1024 16 4 : tunables 0 0 = 0 : slabdata 441 441 0 kmalloc-512 7700 8256 512 16 2 : tunables 0 0 = 0 : slabdata 516 516 0 Now, maybe 576 isn't quite the right size. Need to try it on a variety of configurations and find out. Want to investigate this?