From patchwork Thu Apr 14 08:57:04 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hyeonggon Yoo <42.hyeyoo@gmail.com> X-Patchwork-Id: 12813130 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 58131C433FE for ; Thu, 14 Apr 2022 08:57:41 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 9F9526B0073; Thu, 14 Apr 2022 04:57:40 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 9A93C6B0074; Thu, 14 Apr 2022 04:57:40 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 84A086B0075; Thu, 14 Apr 2022 04:57:40 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (relay.hostedemail.com [64.99.140.27]) by kanga.kvack.org (Postfix) with ESMTP id 76CB56B0073 for ; Thu, 14 Apr 2022 04:57:40 -0400 (EDT) Received: from smtpin22.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id 428B82543B for ; Thu, 14 Apr 2022 08:57:40 +0000 (UTC) X-FDA: 79354881480.22.CC551B8 Received: from mail-pl1-f171.google.com (mail-pl1-f171.google.com [209.85.214.171]) by imf11.hostedemail.com (Postfix) with ESMTP id A69A240007 for ; Thu, 14 Apr 2022 08:57:39 +0000 (UTC) Received: by mail-pl1-f171.google.com with SMTP id 12so4100182pll.12 for ; Thu, 14 Apr 2022 01:57:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=SvUcfGV0AI5Z5Ok9/naO7LBjVi2omORuN4/12C7DmHE=; b=JR2RAEmge/keIR/Ml2wlBOCVlLAFG6iue7Hc3B84gbF39ETD8Z6w5ipfhgjcI5pt7n 3JnqtA6jCC1bW0jZPfN623VDrHkCImpoQypj/WGex6PSaxrG78yJ+B0oaSeDTcxiPJNp 6+7kCsCgADfNs8lZ7ExcafvNtMW+mL8Sxp0dfM5e+MAOc5Dugo3w+JoIdZeUc9/ctGFJ /DOI7zCm0yXvjyIIriUxmTSBHhaO2uTX3GLvTBIH6SYDd6L6Tr/DK4za39KscI7iwIRS ZAV5k+h52w0ZHukEJP+LOLZNUzhayIx+qoSZpg21P01X01Yt7gTi3+tFVmTG+mUm99mi SVDQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=SvUcfGV0AI5Z5Ok9/naO7LBjVi2omORuN4/12C7DmHE=; b=8PlpR+u12IlmXJSZHDUXHSFNWhM3gvrp9GVCxLmBzZP3I1B8lr3FvjzhDvegNZme7w NV/62etnUh5/XadnJZRjFqEk8Tzhpkhch0D2CYpKTkzLmbSnZZxnycNa+MysJhLXB2J4 IbsgbZLgox399tdNgDv1BpJ4ouPybjk+aLZB3ZHSV+Gb7vxs2z5+v5+HNA2kBpzd/DMR t7bT72itb0amONFpooBKWs1kqcBymDL4eRnm5dq5r2UW52rXv169um0Y2/4iiFUBMCME xi9h4ZtRWDcstK9sZUHBwz3cFUlwMwfIkBNaZaMPV9Z/uBIgNAt7lJdK6Blii+c8MaiT 6seA== X-Gm-Message-State: AOAM533out+yP9JiFaLB2yMrBBxxUdL1SXWH7M83me/E6UKkgZoIFIV/ 07VZPR3Pr5IY7pewafJqy/Q= X-Google-Smtp-Source: ABdhPJyizoPS3uBWKhkZvBXCVjTSS1AwqRPB39uv9wUmFhns1Opl4pKj6mE0GhOs94q49W+tXxsj1Q== X-Received: by 2002:a17:902:b495:b0:158:8318:4cf9 with SMTP id y21-20020a170902b49500b0015883184cf9mr13576324plr.33.1649926658591; Thu, 14 Apr 2022 01:57:38 -0700 (PDT) Received: from hyeyoo.. ([114.29.24.243]) by smtp.gmail.com with ESMTPSA id p9-20020aa79e89000000b00505fada20dfsm1403537pfq.117.2022.04.14.01.57.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 Apr 2022 01:57:36 -0700 (PDT) From: Hyeonggon Yoo <42.hyeyoo@gmail.com> To: Vlastimil Babka Cc: Marco Elver , Matthew WilCox , Christoph Lameter , Pekka Enberg , David Rientjes , Joonsoo Kim , Andrew Morton , Hyeonggon Yoo <42.hyeyoo@gmail.com>, Roman Gushchin , linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 00/23] common kmalloc for SLUB and SLAB v2 Date: Thu, 14 Apr 2022 17:57:04 +0900 Message-Id: <20220414085727.643099-1-42.hyeyoo@gmail.com> X-Mailer: git-send-email 2.32.0 MIME-Version: 1.0 X-Stat-Signature: g77d6bj7m8umgidsh58a694p7y8b495i Authentication-Results: imf11.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=JR2RAEmg; spf=pass (imf11.hostedemail.com: domain of 42.hyeyoo@gmail.com designates 209.85.214.171 as permitted sender) smtp.mailfrom=42.hyeyoo@gmail.com; dmarc=pass (policy=none) header.from=gmail.com X-Rspam-User: X-Rspamd-Server: rspam02 X-Rspamd-Queue-Id: A69A240007 X-HE-Tag: 1649926659-424025 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: Changes since v1: - The code is basically same, but split some patches to make it easier to review. - Adjusted comments and added Reviewed-by from Vlastimil. Thanks! Hello, this series is cleanup of kmalloc code. After this series, kmalloc subsystem is perfectly generalized on SLAB and SLUB. This series is not small, but each patch is easy to review and I bet you will like this :) Many thanks to Matthew, Marco, Vlastimil who gave comments in previous series. Any feedbacks will be appreciated. Thanks! ======== series description ======= patch 1-2 make slab_alloc_node() in SLAB available for non-NUMA configurations for further cleanup. patch 3-12 remove duplicate code in common kmalloc functions. patch 13 makes SLAB pass requests larger than order-1 page to page allocator. This is useful for further generalization. patch 14-16 unify tracepoints. after them, we use only kmem_cache_alloc and kmem_cache_free tracepoints in slab allocators. patch 17-18 generalize whole kmalloc subsystem on SLAB/SLUB. patch 19-20 factor out common code of __kmalloc_node() and __kmalloc_node_track_caller(). patch 21 removes now unnecessary kmem_cache_alloc_node_trace(). patch 22-23 is small improvements of __ksize(). They are not part of generalization but depends on this series. Hyeonggon Yoo (23): mm/slab: move NUMA-related code to __do_cache_alloc() mm/slab: cleanup slab_alloc() and slab_alloc_node() mm/slab_common: remove CONFIG_NUMA ifdefs for common kmalloc functions mm/slab_common: cleanup kmalloc_track_caller() mm/slab_common: cleanup __kmalloc() mm/sl[auo]b: fold kmalloc_order_trace() into kmalloc_large() mm/slub: move kmalloc_large_node() to slab_common.c mm/slab_common: make kmalloc_large_node() consistent with kmalloc_large() mm/slab_common: cleanup kmalloc_large() mm/slab_common: cleanup kmem_cache_alloc{,node,lru} mm/slab_common: kmalloc_node: pass large requests to page allocator mm/slab_common: cleanup kmalloc() mm/slab: kmalloc: pass requests larger than order-1 page to page allocator mm/slab_common: print cache name in tracepoints mm/slab_common: use same tracepoint in kmalloc and normal caches mm/slab_common: rename tracepoint mm/slab_common: implement __kmem_cache_free() mm/sl[au]b: generalize kmalloc subsystem mm/slab_common: add kasan_kmalloc() in __kmalloc_node_track_caller() mm/slab_common: factor out __do_kmalloc_node() mm/sl[au]b: remove kmem_cache_alloc_node_trace() mm/sl[auo]b: move definition of __ksize() to mm/slab.h mm/sl[au]b: check if large object is valid in __ksize() include/linux/slab.h | 245 ++++++++++++------------- include/trace/events/kmem.h | 109 ++--------- mm/slab.c | 354 ++++++------------------------------ mm/slab.h | 9 + mm/slab_common.c | 146 ++++++++++++--- mm/slob.c | 78 +++----- mm/slub.c | 264 ++------------------------- 7 files changed, 350 insertions(+), 855 deletions(-)