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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5C8B1C433F5 for ; Tue, 12 Apr 2022 23:46:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231493AbiDLXsT (ORCPT ); Tue, 12 Apr 2022 19:48:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48112 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231449AbiDLXr5 (ORCPT ); Tue, 12 Apr 2022 19:47:57 -0400 Received: from mail-pf1-x436.google.com (mail-pf1-x436.google.com [IPv6:2607:f8b0:4864:20::436]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4CC73DEB2 for ; Tue, 12 Apr 2022 16:38:23 -0700 (PDT) Received: by mail-pf1-x436.google.com with SMTP id j17so428780pfi.9 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=ZOTl9IBBJbhcvAAf15TtXBXvzVF4d7RyD7Hu8iDNElTiaD7iZgj5zROaxuLdCWiRXU W+FE/ikp7JVaifAmGbrbMaKVtumME3IcY3Nhw1BqjOf2vO20gFS9KMdw8ITuUVmEySg5 hj+O7OYRdAfbiC+9BI/obk991rTfDFMMTnG83sVu0qQPe2/r3jloDjx2neYMm88oeg9w TQz81spR3Fo+mmnF2aCQpKC/LYe6482x8DGc6fmTfKgCTe3VL+gGtWAMbkwxBKoGH/Oy KCW7qM+IPEpSQ2oBSeJm4ib2APhXslm+DbXZf9N8BifVP/xD9BhMy/nCnNbGYHV/4dem g3+g== X-Gm-Message-State: AOAM5309V3Fa93RDpV08pBXxIZ8B/7vcw1lEq7bET24V73qfpjzY57df qrnzpRAHomDLbqme6/47y+EQcg== 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 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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