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=-7.9 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 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 C67E6C433B4 for ; Wed, 5 May 2021 23:06:31 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 48A9F613C9 for ; Wed, 5 May 2021 23:06:31 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 48A9F613C9 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id CD8556B006C; Wed, 5 May 2021 19:06:30 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id C87F36B006E; Wed, 5 May 2021 19:06:30 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id ADAFF6B0070; Wed, 5 May 2021 19:06:30 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0001.hostedemail.com [216.40.44.1]) by kanga.kvack.org (Postfix) with ESMTP id 92CF66B006C for ; Wed, 5 May 2021 19:06:30 -0400 (EDT) Received: from smtpin01.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id 4B83A4405 for ; Wed, 5 May 2021 23:06:30 +0000 (UTC) X-FDA: 78108713340.01.97DF4A5 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by imf03.hostedemail.com (Postfix) with ESMTP id 9E598C0007C6 for ; Wed, 5 May 2021 23:06:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1620255989; h=from:from:reply-to:subject:subject: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=Y2UtSfp8BrCUffF0CdlLACo8aqMI+/YAkO0AYQU2b30=; b=JwfgG38UNWvfPJMXJyJdeaj0x9y2sMV028+qiBOeK6LxgTd8OvAuI65qNH484o9nwOfI1i t/nLmqKhXFGTViyk8Z7KIlD/2fgOxDc97zT5e8xDPW7sRkfG2AoY9qDXruq37Yj/DKL+WZ xoiSEMAOOEMNlE6F8wREDf5hHowUjIM= Received: from mail-qk1-f200.google.com (mail-qk1-f200.google.com [209.85.222.200]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-60-vJDwaXLWMGidOLEtSFQ6sg-1; Wed, 05 May 2021 19:06:27 -0400 X-MC-Unique: vJDwaXLWMGidOLEtSFQ6sg-1 Received: by mail-qk1-f200.google.com with SMTP id s123-20020a3777810000b02902e9adec2313so2232946qkc.4 for ; Wed, 05 May 2021 16:06:27 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:subject:to:cc:references:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding :content-language; bh=Y2UtSfp8BrCUffF0CdlLACo8aqMI+/YAkO0AYQU2b30=; b=PDGOXSuAPiO7BPjLVw1gR/UjVBpaW3y4HpYVWTtbNLmTrrG2XC9hQsqw3err3yLa6V QXo2uLetjMq7AduKsWRIEeoMVhhftpPDe3YoithQ1HT9dst5O8tXsxk4lDti4PV2ec6n GXV6BAst/KWfQ6O8NRQoTjSyiWw0viRg6y2+IP6Jn43qy4RfVa9Gvou9uC6n74CLuUrZ xbrQpHv2hrYToPwcL+/aNvxlRCBMcW4yKHpUCTyl/PD1MocAtV11u7UCHL18Fj5+I5zy VPYZv7YplvZg1Mdaj53IMSx5c+bnIjrRRg2+Vn3HObdzj9WIHgiI+ca9K4iiuWn0/W4R KNvw== X-Gm-Message-State: AOAM531XJj6Tm0kYvMUwSyX5pb0n0/aR3p+CpNptW2aK4DCu8KnzmYIN O7C0IsYb7ax1u2o0/7RrG7PSkEbd/CN3DLoVpB51+A3raOjCGKAcJI48rT+VqVYUQ+lxKSNlPZV NjG787lQBVrTsUAAr8DxLI3tvV7REGLXAhXPq5HBLHHQSYKOBzV1pY33nSlg= X-Received: by 2002:a05:6214:f6e:: with SMTP id iy14mr1253382qvb.53.1620255986925; Wed, 05 May 2021 16:06:26 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw3hH/gk/oToXyZz2B9Atla//dvgE163CPVjfB/H70FKKvN99+oSJaI0N0HRHRQQFmidgkzUw== X-Received: by 2002:a05:6214:f6e:: with SMTP id iy14mr1253349qvb.53.1620255986621; Wed, 05 May 2021 16:06:26 -0700 (PDT) Received: from llong.remote.csb ([2601:191:8500:76c0::cdbc]) by smtp.gmail.com with ESMTPSA id j196sm726721qke.25.2021.05.05.16.06.25 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 05 May 2021 16:06:26 -0700 (PDT) From: Waiman Long X-Google-Original-From: Waiman Long Subject: Re: [PATCH v3 2/2] mm: memcg/slab: Create a new set of kmalloc-cg- caches To: Roman Gushchin , Vlastimil Babka Cc: Johannes Weiner , Michal Hocko , Vladimir Davydov , Andrew Morton , Christoph Lameter , Pekka Enberg , David Rientjes , Joonsoo Kim , Shakeel Butt , linux-kernel@vger.kernel.org, cgroups@vger.kernel.org, linux-mm@kvack.org References: <20210505154613.17214-1-longman@redhat.com> <20210505154613.17214-3-longman@redhat.com> <235f45b4-2d99-f32d-ac2b-18b59fea5a25@suse.cz> Message-ID: <95ab4bdf-f373-f71d-cdf5-05ad6edbb772@redhat.com> Date: Wed, 5 May 2021 19:06:24 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.9.0 MIME-Version: 1.0 In-Reply-To: X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-US X-Rspamd-Queue-Id: 9E598C0007C6 Authentication-Results: imf03.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=JwfgG38U; dmarc=pass (policy=none) header.from=redhat.com; spf=none (imf03.hostedemail.com: domain of llong@redhat.com has no SPF policy when checking 170.10.133.124) smtp.mailfrom=llong@redhat.com X-Rspamd-Server: rspam04 X-Stat-Signature: hohbbnoww3jhme9oexzo71135znsfy38 Received-SPF: none (redhat.com>: No applicable sender policy available) receiver=imf03; identity=mailfrom; envelope-from=""; helo=us-smtp-delivery-124.mimecast.com; client-ip=170.10.133.124 X-HE-DKIM-Result: pass/pass X-HE-Tag: 1620255982-889273 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 5/5/21 6:19 PM, Roman Gushchin wrote: > On Wed, May 05, 2021 at 11:29:54PM +0200, Vlastimil Babka wrote: >> On 5/5/21 8:32 PM, Roman Gushchin wrote: >>> On Wed, May 05, 2021 at 08:02:06PM +0200, Vlastimil Babka wrote: >>>> On 5/5/21 7:30 PM, Roman Gushchin wrote: >>>>> On Wed, May 05, 2021 at 11:46:13AM -0400, Waiman Long wrote: >>>>>> With this change, all the objcg pointer array objects will come from >>>>>> KMALLOC_NORMAL caches which won't have their objcg pointer arrays. So >>>>>> both the recursive kfree() problem and non-freeable slab problem are >>>>>> gone. Since both the KMALLOC_NORMAL and KMALLOC_CGROUP caches no longer >>>>>> have mixed accounted and unaccounted objects, this will slightly reduce >>>>>> the number of objcg pointer arrays that need to be allocated and save >>>>>> a bit of memory. >>>>> Unfortunately the positive effect of this change will be likely >>>>> reversed by a lower utilization due to a larger number of caches. >>>>> >>>>> Btw, I wonder if we also need a change in the slab caches merging procedure? >>>>> KMALLOC_NORMAL caches should not be merged with caches which can potentially >>>>> include accounted objects. >>>> Good point. But looks like kmalloc* caches are extempt from all merging in >>>> create_boot_cache() via >>>> >>>> s->refcount = -1; /* Exempt from merging for now */ >>> Wait, s->refcount is adjusted to 1 in create_kmalloc_cache() after calling >>> into create_boot_cache? >> Hmm I missed that >> >> Now I wonder why all kmalloc caches on my system have 0 aliases :) >> cat /sys/kernel/slab/kmalloc-*/aliases > Yeah, I noticed it too, it's a good question. And I remember a case from > the past when it wasn't true (kmalloc-32 was shared with something else). > The criteria for cache merging require close to exact match in all attributes with a size difference of no more than sizeof(void *). So it is not easy to find a close match. Cheers, Longman