From patchwork Mon Oct 4 13:45:48 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Wilcox X-Patchwork-Id: 12533963 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 9D0C4C433EF for ; Mon, 4 Oct 2021 13:49:25 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 18E9D61207 for ; Mon, 4 Oct 2021 13:49:24 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 18E9D61207 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=kvack.org Received: by kanga.kvack.org (Postfix) id 6F531940015; Mon, 4 Oct 2021 09:49:24 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 6A51694000B; Mon, 4 Oct 2021 09:49:24 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 594B0940015; Mon, 4 Oct 2021 09:49:24 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0005.hostedemail.com [216.40.44.5]) by kanga.kvack.org (Postfix) with ESMTP id 45AEA94000B for ; Mon, 4 Oct 2021 09:49:24 -0400 (EDT) Received: from smtpin32.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id F284F8248076 for ; Mon, 4 Oct 2021 13:49:23 +0000 (UTC) X-FDA: 78658887006.32.70413E0 Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) by imf27.hostedemail.com (Postfix) with ESMTP id 52F03700194F for ; Mon, 4 Oct 2021 13:49:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Content-Transfer-Encoding:MIME-Version: Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To:Content-Type:Content-ID: Content-Description:In-Reply-To:References; bh=LzN0W154tgvpae2j7LTrGY7R0PgexPxtl1ZroovCsQo=; b=NQzKeVKT9jSeafn2sTzKiCxkXG 1IEDUUCNyPd3zwcHMqVmN3HUjiY0koIBF+KFPuUhXUTYXDlDz6BVAi8WXH6kDSMg+vfSHeDRnALQ0 3ptoH9ycJQFhmVies1fXAvvuxJIPfCjp8Oa73VmvbHMmpRGFM/qpW8dI4GyLCbdEd1M08V7lmPt1B SvbyQ7QiKEyEfqRI3s6tr1A4uEjTxFRQEEUS8xCsQF/dTotZMnKpJP7xCDc/BLJcWh4In52qtsakh 9yRdFL2r/qGF4paftCP7nzOtxmhGrGuNBv5wxvagpfxVRyzIHJ+cFkBhAdRvt/R8jASJR0Dyh8OAO i/1e3JGQ==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1mXOIw-00Gust-VC; Mon, 04 Oct 2021 13:47:03 +0000 From: "Matthew Wilcox (Oracle)" To: linux-mm@kvack.org Cc: "Matthew Wilcox (Oracle)" Subject: [PATCH 00/62] Separate struct slab from struct page Date: Mon, 4 Oct 2021 14:45:48 +0100 Message-Id: <20211004134650.4031813-1-willy@infradead.org> X-Mailer: git-send-email 2.31.1 MIME-Version: 1.0 X-Rspamd-Server: rspam01 X-Rspamd-Queue-Id: 52F03700194F X-Stat-Signature: 6esgom6rbbhpmuecgauoyynshiazar6k Authentication-Results: imf27.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=NQzKeVKT; dmarc=none; spf=none (imf27.hostedemail.com: domain of willy@infradead.org has no SPF policy when checking 90.155.50.34) smtp.mailfrom=willy@infradead.org X-HE-Tag: 1633355363-30519 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: This is an offshoot of the folio work, although it does not depend on any of the outstanding pieces of folio work. One of the more complex parts of the struct page definition is the parts used by the slab allocators. It would be good for the MM in general if struct slab were its own data type, and it also helps to prevent tail pages from slipping in anywhere. The slub conversion is done "properly", ie in individually reviewable, bisectable chunks. The slab & slob conversions are slapdash. The patches to switch bootmem & zsmalloc away from slab elements are also expedient instead of well thought through. The KASAN and memcg parts would also benefit from a more thoughtful approach. I'm not entirely happy with slab_test_cache() for a predicate name. I actually liked SlabAllocation() better, but then I remembered that we're trying to get away from InterCapping, and somehow slab_test_allocation() didn't feel right either. I don't know the slab allocators terribly well, so I would be very grateful if one of the slab maintainers took over this effort. This is kind of a distraction from what I'm really trying to accomplish with folios, although it has found one minor bug. Matthew Wilcox (Oracle) (62): mm: Convert page_to_section() to pgflags_section() mm: Add pgflags_nid() mm: Split slab into its own type mm: Add account_slab() and unaccount_slab() mm: Convert virt_to_cache() to use struct slab mm: Convert __ksize() to struct slab mm: Use struct slab in kmem_obj_info() mm: Convert check_heap_object() to use struct slab mm/slub: Convert process_slab() to take a struct slab mm/slub: Convert detached_freelist to use a struct slab mm/slub: Convert kfree() to use a struct slab mm/slub: Convert __slab_free() to take a struct slab mm/slub: Convert new_slab() to return a struct slab mm/slub: Convert early_kmem_cache_node_alloc() to use struct slab mm/slub: Convert kmem_cache_cpu to struct slab mm/slub: Convert show_slab_objects() to struct slab mm/slub: Convert validate_slab() to take a struct slab mm/slub: Convert count_partial() to struct slab mm/slub: Convert bootstrap() to struct slab mm/slub: Convert __kmem_cache_do_shrink() to struct slab mm/slub: Convert free_partial() to use struct slab mm/slub: Convert list_slab_objects() to take a struct slab mm/slub: Convert slab_alloc_node() to use a struct slab mm/slub: Convert get_freelist() to take a struct slab mm/slub: Convert node_match() to take a struct slab mm/slub: Convert slab flushing to struct slab mm/slub: Convert __unfreeze_partials to take a struct slab mm/slub: Convert deactivate_slab() to take a struct slab mm/slub: Convert acquire_slab() to take a struct page mm/slub: Convert partial slab management to struct slab mm/slub: Convert slab freeing to struct slab mm/slub: Convert shuffle_freelist to struct slab mm/slub: Remove struct page argument to next_freelist_entry() mm/slub: Remove struct page argument from setup_object() mm/slub: Convert freelist_corrupted() to struct slab mm/slub: Convert full slab management to struct slab mm/slub: Convert free_consistency_checks() to take a struct slab mm/slub: Convert alloc_debug_processing() to struct slab mm/slub: Convert check_object() to struct slab mm/slub: Convert on_freelist() to struct slab mm/slub: Convert check_slab() to struct slab mm/slub: Convert check_valid_pointer() to struct slab mm/slub: Convert object_err() to take a struct slab mm/slub: Convert print_trailer() to struct slab mm/slub: Convert slab_err() to take a struct slab mm/slub: Convert print_page_info() to print_slab_info() mm/slub: Convert trace() to take a struct slab mm/slub: Convert cmpxchg_double_slab to struct slab mm/slub: Convert get_map() and __fill_map() to struct slab mm/slub: Convert slab_lock() and slab_unlock() to struct slab mm/slub: Convert setup_page_debug() to setup_slab_debug() mm/slub: Convert pfmemalloc_match() to take a struct slab mm/slub: Remove pfmemalloc_match_unsafe() mm: Convert slab to use struct slab mm: Convert slob to use struct slab mm: Convert slub to use struct slab memcg: Convert object cgroups from struct page to struct slab mm/kasan: Convert to struct slab zsmalloc: Stop using slab fields in struct page bootmem: Use page->index instead of page->freelist iommu: Use put_pages_list mm: Remove slab from struct page arch/x86/mm/init_64.c | 2 +- drivers/iommu/amd/io_pgtable.c | 99 +-- drivers/iommu/dma-iommu.c | 11 +- drivers/iommu/intel/iommu.c | 89 +-- include/asm-generic/memory_model.h | 2 +- include/linux/bootmem_info.h | 2 +- include/linux/iommu.h | 3 +- include/linux/kasan.h | 8 +- include/linux/memcontrol.h | 34 +- include/linux/mm.h | 16 +- include/linux/mm_types.h | 82 +- include/linux/page-flags.h | 66 +- include/linux/slab.h | 8 - include/linux/slab_def.h | 16 +- include/linux/slub_def.h | 25 +- mm/bootmem_info.c | 7 +- mm/kasan/common.c | 25 +- mm/kasan/generic.c | 8 +- mm/kasan/kasan.h | 2 +- mm/kasan/quarantine.c | 2 +- mm/kasan/report.c | 16 +- mm/kasan/report_tags.c | 10 +- mm/memcontrol.c | 33 +- mm/slab.c | 423 +++++----- mm/slab.h | 164 +++- mm/slab_common.c | 8 +- mm/slob.c | 42 +- mm/slub.c | 1143 ++++++++++++++-------------- mm/sparse.c | 8 +- mm/usercopy.c | 13 +- mm/zsmalloc.c | 18 +- 31 files changed, 1212 insertions(+), 1173 deletions(-)