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 mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7EEF9C433F5 for ; Wed, 20 Oct 2021 11:46:46 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 1505E610CB for ; Wed, 20 Oct 2021 11:46:46 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 1505E610CB Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=kvack.org Received: by kanga.kvack.org (Postfix) id 9B31A6B0072; Wed, 20 Oct 2021 07:46:45 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 962046B0073; Wed, 20 Oct 2021 07:46:45 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 82A14900002; Wed, 20 Oct 2021 07:46:45 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0199.hostedemail.com [216.40.44.199]) by kanga.kvack.org (Postfix) with ESMTP id 75CB86B0072 for ; Wed, 20 Oct 2021 07:46:45 -0400 (EDT) Received: from smtpin22.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id 3AB94181AEF3E for ; Wed, 20 Oct 2021 11:46:45 +0000 (UTC) X-FDA: 78716638770.22.9CED8CF Received: from mail-pf1-f181.google.com (mail-pf1-f181.google.com [209.85.210.181]) by imf02.hostedemail.com (Postfix) with ESMTP id 8F7067001A24 for ; Wed, 20 Oct 2021 11:46:42 +0000 (UTC) Received: by mail-pf1-f181.google.com with SMTP id m26so2740706pff.3 for ; Wed, 20 Oct 2021 04:46:44 -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=/CtzRUum4TEm7dhVCZPF7Qv3OkcjTAJgigCewjxDris=; b=aaqCctI/JXU0ho9YJ2RGMRHqvwSupruDY3wXfD1/865eGLLD9vQnlwktuNYIO5RMVi pOm+f/QhQeohQWnt0SZWCBv9/9ozJdQzIOwpqc45H0IXuRE2FlU+xb8wPC8gm2kSMcmy x4gO31h56mNIoNm2rFa/aoCukvo2GThMPTMLE8lkrWmhrJP9o3xnnQIEg5xtrloVW2IH eAvrG5f8GwkCE6sj5IxyGYZQDeVNnjUIFCkIF72jiJeITM1YFKiSG7fvpNwPQv/35lml ntwOc6jvGdzPIK9+rxsF3t08ogOMQGg5TuLDycIX8DQTZrAnnPpwE7kAU3slQF1UCUz7 UyNg== 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=/CtzRUum4TEm7dhVCZPF7Qv3OkcjTAJgigCewjxDris=; b=qgsxYyPKzaxlMeIX3pcVGdmQevgxw00alKEdBkS7d1R6PN40NCcdD2J/h/Fr3v9KgP oR79ufI7ow8ibolDts9jyiN0Ia5ANbWW4j9rg6z9OhFG+QsMePqDyH2Xs8VBe7BjuFbF aYnLXVNhg6Lks+M8QjzJLQd3c4WlHJa5i5AhOKBhVLRn1+BTbEi1vuHh3DeyW+NiDBE3 w95WVic2lIUu03J3NotQRo6GUHvRf77eUgsQUvqYg89jF0s4Lra/BZFXl3wKFCv+9LXg 5nPctgeujef7xEwcmfnNQd9tuxEkM50gu7rjUpfDKhtwQJAQP+W6wznmE+DhWGjROs0S lJTA== X-Gm-Message-State: AOAM530Ug+PN87Z4xFgDZkMVKqfoGMTQ/+cMv6vGvYNpJiNFapVPpMM5 sui1e86bKfgfKrV0Nu6GzJE= X-Google-Smtp-Source: ABdhPJxc7MdkcNH3vp2JLHAexDGsSQHeFiIFMAFvqxlRvhRMHK8rnR7chMyocY10Zg9HkdDDhNBwUQ== X-Received: by 2002:a05:6a00:234f:b0:3eb:3ffd:6da2 with SMTP id j15-20020a056a00234f00b003eb3ffd6da2mr5787974pfj.15.1634730403839; Wed, 20 Oct 2021 04:46:43 -0700 (PDT) Received: from kvm.asia-northeast3-a.c.our-ratio-313919.internal (21.210.64.34.bc.googleusercontent.com. [34.64.210.21]) by smtp.gmail.com with ESMTPSA id v22sm2393547pff.93.2021.10.20.04.46.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 Oct 2021 04:46:43 -0700 (PDT) Date: Wed, 20 Oct 2021 11:46:38 +0000 From: Hyeonggon Yoo <42.hyeyoo@gmail.com> To: Rustam Kovhaev Cc: vbabka@suse.cz, cl@linux.com, penberg@kernel.org, rientjes@google.com, iamjoonsoo.kim@lge.com, akpm@linux-foundation.org, djwong@kernel.org, david@fromorbit.com, linux-kernel@vger.kernel.org, linux-mm@kvack.org, gregkh@linuxfoundation.org, viro@zeniv.linux.org.uk, dvyukov@google.com Subject: Re: [PATCH] slob: add size header to all allocations Message-ID: <20211020114638.GA378758@kvm.asia-northeast3-a.c.our-ratio-313919.internal> References: <20211015005729.GD24333@magnolia> <20211018033841.3027515-1-rkovhaev@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20211018033841.3027515-1-rkovhaev@gmail.com> X-Rspamd-Server: rspam01 X-Rspamd-Queue-Id: 8F7067001A24 X-Stat-Signature: 7of18kqykyrd7ogjfkossb5ajfzrp6h3 Authentication-Results: imf02.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b="aaqCctI/"; spf=pass (imf02.hostedemail.com: domain of 42.hyeyoo@gmail.com designates 209.85.210.181 as permitted sender) smtp.mailfrom=42.hyeyoo@gmail.com; dmarc=pass (policy=none) header.from=gmail.com X-HE-Tag: 1634730402-923787 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 Sun, Oct 17, 2021 at 08:38:41PM -0700, Rustam Kovhaev wrote: > Let's prepend all allocations of (PAGE_SIZE - align_offset) and less > with the size header. This way kmem_cache_alloc() memory can be freed > with kfree() and the other way around, as long as they are less than > (PAGE_SIZE - align_offset). Hello Rustam, I measured its impact on memory usage on tiny kernel configuration as SLOB is used in very small machine. on x86 32 bit + tinyconfig: Before: Slab: 668 kB After: Slab: 688~692 kB it adds 20~24kB. > > The main reason for this change is to simplify SLOB a little bit, make > it a bit easier to debug whenever something goes wrong. > It seems acceptable But I wonder it is worth to increase memory usage to allow freeing kmem_cache_alloc-ed objects by kfree()? Thanks, Hyeonggon > meminfo right after the system boot, without the patch: > Slab: 35500 kB > > the same, with the patch: > Slab: 36396 kB >