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 kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 91B96C433F5 for ; Tue, 12 Apr 2022 23:38:25 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id EF1266B0072; Tue, 12 Apr 2022 19:38:24 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id E79566B0073; Tue, 12 Apr 2022 19:38:24 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id D19286B0074; Tue, 12 Apr 2022 19:38:24 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0194.hostedemail.com [216.40.44.194]) by kanga.kvack.org (Postfix) with ESMTP id BFB536B0072 for ; Tue, 12 Apr 2022 19:38:24 -0400 (EDT) Received: from smtpin29.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id 8513BAA086 for ; Tue, 12 Apr 2022 23:38:24 +0000 (UTC) X-FDA: 79349843328.29.D7A8C24 Received: from mail-pg1-f171.google.com (mail-pg1-f171.google.com [209.85.215.171]) by imf16.hostedemail.com (Postfix) with ESMTP id E7A4A180003 for ; Tue, 12 Apr 2022 23:38:23 +0000 (UTC) Received: by mail-pg1-f171.google.com with SMTP id k29so96282pgm.12 for ; Tue, 12 Apr 2022 16:38:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=date:from:to:cc:subject:in-reply-to:message-id:references :mime-version; bh=MN0KLt5utuSN7YPPe/RQoqZU5F9l+RATon8sXwZ2y5w=; b=mdoXyJVzAvazeUqmdgjYlBUswr1qDbZbdPS3o59IAbiF2I+379unMu5yVplVH4k/GG B8cHWZAc2gf7Q+sGQnzyoBXkFjlV81u3WcvjuYibX4hdJaa69QG1qbOe17MaqGj70xp8 8HY95CQLZNY2VI8AB+GUv/7MNBdNuT4iYc0civR4f3kfeczHZcQCl4hyoS3K9qhs8DYa T1br6dmAAB9goe9EnDWNq7WtAZJdyTVh1vWK6dCKQ45/6hxxOBQ2n5eRA/qbgovD/9JF IE8yxjWwpxIyjSdXIXUCXUZAI8/OBqoXSWYFcuiMJKrcWRERo7o0eeK+g5wma0jI1mFu mzIw== 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:in-reply-to:message-id :references:mime-version; bh=MN0KLt5utuSN7YPPe/RQoqZU5F9l+RATon8sXwZ2y5w=; b=u+F06mr9ZL+iIDKfqTgENDbUFMpRki3h5t+84arD+UIW7JpMDWUww32+FHM677PXCg Dm8T/yc+KrykE1h2v1TXftgvauUkm7dYwms7ZZ8RMHs/HJJ88TXPY4+d6YDvUJ80WAQ5 TMwE4lPQw4SdHq41+HGzs3UMitR65GFJjGI4wZdhOa69GpPmrMSfcKpqrJcpuPsosEaf 1IjBco5acp/xxiPLAFYQewf6RUJTcMZWvLYA6narlKzRdYnNPJDoR1HMmzfZmRi2NR6Y kFuTpCUFaOUyaQzYJ2yKWTmyJkMMpFWGwrlQ2uIMOaZlIZbDx/4xMq6t7TrstYZTX/wu EbLg== X-Gm-Message-State: AOAM532MfOasZXd10jx1UfHBPmJUWmyIY2xDn8apTlWpFJf7bqEXPdxJ R7HLiMg2FAU6+S7a2lj8rGBQsA== X-Google-Smtp-Source: ABdhPJyAnwlsQIgtopXxAYoBqqshq0c3q/h/noRnBGj+R/Iybto8sISq2ZZp61XWr4dN4QPH22aqrw== X-Received: by 2002:a65:6c0b:0:b0:39d:8c30:4bb9 with SMTP id y11-20020a656c0b000000b0039d8c304bb9mr5496654pgu.411.1649806702606; Tue, 12 Apr 2022 16:38:22 -0700 (PDT) Received: from [2620:15c:29:204:1a89:45ec:16da:55dc] ([2620:15c:29:204:1a89:45ec:16da:55dc]) by smtp.gmail.com with ESMTPSA id j12-20020a056a00234c00b00505deacf78dsm4890816pfj.149.2022.04.12.16.38.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Apr 2022 16:38:22 -0700 (PDT) Date: Tue, 12 Apr 2022 16:38:21 -0700 (PDT) From: David Rientjes To: Ohhoon Kwon cc: Hyeonggon Yoo <42.hyeyoo@gmail.com>, Christoph Lameter , Pekka Enberg , Joonsoo Kim , Andrew Morton , Vlastimil Babka , Roman Gushchin , JaeSang Yoo , Wonhyuk Yang , Jiyoup Kim , Donghyeok Kim , linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v2] mm/slab_common: move dma-kmalloc caches creation into new_kmalloc_cache() In-Reply-To: <20220410162511.656541-1-ohkwon1043@gmail.com> Message-ID: References: <20220410162511.656541-1-ohkwon1043@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII X-Rspamd-Server: rspam06 X-Rspamd-Queue-Id: E7A4A180003 X-Rspam-User: Authentication-Results: imf16.hostedemail.com; dkim=pass header.d=google.com header.s=20210112 header.b=mdoXyJVz; dmarc=pass (policy=reject) header.from=google.com; spf=pass (imf16.hostedemail.com: domain of rientjes@google.com designates 209.85.215.171 as permitted sender) smtp.mailfrom=rientjes@google.com X-Stat-Signature: h7b11mtixzgo8g4wjowaa6ptqacakz59 X-HE-Tag: 1649806703-991976 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 Mon, 11 Apr 2022, Ohhoon Kwon wrote: > There are four types of kmalloc_caches: KMALLOC_NORMAL, KMALLOC_CGROUP, > KMALLOC_RECLAIM, and KMALLOC_DMA. While the first three types are > created using new_kmalloc_cache(), KMALLOC_DMA caches are created in a > separate logic. Let KMALLOC_DMA caches be also created using > new_kmalloc_cache(), to enhance readability. > > Historically, there were only KMALLOC_NORMAL caches and KMALLOC_DMA > caches in the first place, and they were initialized in two separate > logics. However, when KMALLOC_RECLAIM was introduced in v4.20 via > commit 1291523f2c1d ("mm, slab/slub: introduce kmalloc-reclaimable > caches") and KMALLOC_CGROUP was introduced in v5.14 via > commit 494c1dfe855e ("mm: memcg/slab: create a new set of kmalloc-cg- > caches"), their creations were merged with KMALLOC_NORMAL's only. > KMALLOC_DMA creation logic should be merged with them, too. > > By merging KMALLOC_DMA initialization with other types, the following > two changes might occur: > 1. The order dma-kmalloc- caches added in slab_cache list may be > sorted by size. i.e. the order they appear in /proc/slabinfo may change > as well. > 2. slab_state will be set to UP after KMALLOC_DMA is created. > In case of slub, freelist randomization is dependent on slab_state>=UP, > and therefore KMALLOC_DMA cache's freelist will not be randomized in > creation, but will be deferred to init_freelist_randomization(). > > Co-developed-by: JaeSang Yoo > Signed-off-by: JaeSang Yoo > Signed-off-by: Ohhoon Kwon Acked-by: David Rientjes