From patchwork Mon Nov 20 18:34:12 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vlastimil Babka X-Patchwork-Id: 13461877 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 A83CBC197A0 for ; Mon, 20 Nov 2023 18:34:53 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 9481D6B0398; Mon, 20 Nov 2023 13:34:45 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 4659C6B03A6; Mon, 20 Nov 2023 13:34:45 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 0C1A36B03A9; Mon, 20 Nov 2023 13:34:44 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id 91E5C6B039C for ; Mon, 20 Nov 2023 13:34:44 -0500 (EST) Received: from smtpin11.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id 6DCDF1A069C for ; Mon, 20 Nov 2023 18:34:44 +0000 (UTC) X-FDA: 81479183688.11.89A4A9A Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) by imf17.hostedemail.com (Postfix) with ESMTP id 4179C40005 for ; Mon, 20 Nov 2023 18:34:41 +0000 (UTC) Authentication-Results: imf17.hostedemail.com; dkim=pass header.d=suse.cz header.s=susede2_rsa header.b="A/zYVT7F"; dkim=pass header.d=suse.cz header.s=susede2_ed25519 header.b=OJDT17ry; spf=pass (imf17.hostedemail.com: domain of vbabka@suse.cz designates 195.135.220.28 as permitted sender) smtp.mailfrom=vbabka@suse.cz; dmarc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1700505282; h=from:from:sender: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:dkim-signature; bh=XDePevE9GX1BKoA1NhlhcvLNyMlxXLyXeY5y95pZ5hE=; b=XbT5QBanpz+UKp+XJsOjbrr3RiWvgocVMGgpwjrBLIQUYZFELFy31ArATqEBsk3reEhwLm c/oqRFeEUwID+dA3WyJGKwa1UJEBpp1qqnrVQlzxOrZ8mqLZGuZotJlBjDNXPaqJLLl06J FsTE1VUs/PBw0ea4d6nLRi/Qh8ruUyo= ARC-Authentication-Results: i=1; imf17.hostedemail.com; dkim=pass header.d=suse.cz header.s=susede2_rsa header.b="A/zYVT7F"; dkim=pass header.d=suse.cz header.s=susede2_ed25519 header.b=OJDT17ry; spf=pass (imf17.hostedemail.com: domain of vbabka@suse.cz designates 195.135.220.28 as permitted sender) smtp.mailfrom=vbabka@suse.cz; dmarc=none ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1700505282; a=rsa-sha256; cv=none; b=FP9to1ItY4hDrdaMikcToDNM2XYAu1agQV7IRGiFyJ7VPArTiu0sF3oj/dIuS/RxW93HrA DVaz5r5p/+ziHE0kIkvi/1iB3bT7ur15tgsGHIYWQRE9UfTBm8+xsYClgxdOHdwYhMRgzC gsOlzy4APiLc8wkp/yLLNg1jSN6y3x8= Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id C8EED218F8; Mon, 20 Nov 2023 18:34:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1700505279; h=from:from:reply-to: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=XDePevE9GX1BKoA1NhlhcvLNyMlxXLyXeY5y95pZ5hE=; b=A/zYVT7Fx820C4tzi8eSuAucdooX4h6FC927L+IjA54Qe9YvxrByaTCTlXa499SCJcpQDX DCaaH924radXAEy2h8t6f0+s3rWY58/vJtLAuP2x1p6bn2FHQfgH3oiiHBXi7PxdwyXbtn MGTGou1b3lHqR0DtoIePDQhuSYDJ/30= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1700505279; h=from:from:reply-to: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=XDePevE9GX1BKoA1NhlhcvLNyMlxXLyXeY5y95pZ5hE=; b=OJDT17ry6C/LwnJ27TILex6mGaKTCUp7y6Oix12iBRNVJTSAyohHfQY/cpHEPL9Av5Wgk1 F7BjUrQcvf9LrVDg== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 7F7D213912; Mon, 20 Nov 2023 18:34:39 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id +I10Hr+mW2UUMgAAMHmgww (envelope-from ); Mon, 20 Nov 2023 18:34:39 +0000 From: Vlastimil Babka Date: Mon, 20 Nov 2023 19:34:12 +0100 Subject: [PATCH v2 01/21] mm/slab, docs: switch mm-api docs generation from slab.c to slub.c MIME-Version: 1.0 Message-Id: <20231120-slab-remove-slab-v2-1-9c9c70177183@suse.cz> References: <20231120-slab-remove-slab-v2-0-9c9c70177183@suse.cz> In-Reply-To: <20231120-slab-remove-slab-v2-0-9c9c70177183@suse.cz> To: David Rientjes , Christoph Lameter , Pekka Enberg , Joonsoo Kim Cc: Andrew Morton , Hyeonggon Yoo <42.hyeyoo@gmail.com>, Roman Gushchin , Andrey Ryabinin , Alexander Potapenko , Andrey Konovalov , Dmitry Vyukov , Vincenzo Frascino , Marco Elver , Johannes Weiner , Michal Hocko , Shakeel Butt , Muchun Song , Kees Cook , linux-mm@kvack.org, linux-kernel@vger.kernel.org, kasan-dev@googlegroups.com, cgroups@vger.kernel.org, linux-hardening@vger.kernel.org, Vlastimil Babka X-Mailer: b4 0.12.4 X-Rspamd-Queue-Id: 4179C40005 X-Rspam-User: X-Stat-Signature: h4jo4nwa3y3hdrhx8fzgnpxxudafdz67 X-Rspamd-Server: rspam01 X-HE-Tag: 1700505281-902498 X-HE-Meta: U2FsdGVkX1+KwadIBP+RrHGDsXGbl/S23pV9L3nLc3k9dSxm8ANatGSmlLsZEk/ujGDMmYIIZ1KzzPYuWa+59PtnckCrUrbprMRn/WISfRU4ara0HgLAVOK3b4CnYWZUdMmWeQ8inIeiDjPFfxvOeXQnbUUxtaWFfa5dqoQr/bboYYJOoAV6EO1KXSt81oqVhHA8OvhpUKkLb6OD9rSVYpyeBZuCpQ6tzmxrHMcQK32Yk3IeHy+Dx1nYxpdVwQhwane0j1/rX3YPPaWBvJ+5hvqp9zJaFSubQq7MMaT2Xj1UkZdZuXzDGhrsfsCeORQddJOrA77e9Dsju+932Qd0UCLrKm0RvcXD3FL4lB1v57LEMDW9j8mO+UrFyqPzpidogahWeXFWlds8z+Q8ti2m3pEXMe1NfBmQPXa1fUwcsCOE+OirDPvkchs+IxoRD9Tuko8Cjrlz3gfD4Gbu0kzumGr+VVcXCaPxG1cAuytiPgTsAXc6r0SgIL/37mbOCwyWyVfNH5Wr7X1pMmdL0MbOQhftuy4hZUmmzner2G5NYJjvVlVx0FXNMjYrLiyrkXRE+wK14hgS3PGV9gLAXp8pd4yr+GgZoQOaK2XbdZ2E0aA0o1m4OZ/TxGOo7ZA60K7/loeCPFyH+buYclxMQVILgnADHZlGbCLp0T1Oi0dzKOiqD0Y3gmpDCfvRHnm8vydzMO/n7rqEiqH6knORJJafz1n4zh0I41YfBZVTxo17IUXtJ2ni9vByuHUImWd0lSfJRU9c5TsoQ/LdyTbaBoNA3ssiSKS/fuAEDb+FR1QRjL0UkX5JHtKzL4xCuek73aCBAS7ELXT90ZcH1/TIwhfljyTkhq+tXV5aEvJp/jOQbOumYouiOdA/lBHH1MYzHu2rPfrjFNwHEs92XGHBF0dcdLVneHzmzO6zwjMAtmAF+xvXk07JnA480y6qIoNM+bgIWdAeJX1NhQejOC7VuB8 XVYcW06j 6Sf+Cd7mfPP43yaJYAWS0qNDkghha3tWzOVM29VBpCA2jEwO7TmA2VLUQBDhIg8EphzZNBCdR6xI81r1dJeT2yMkRd1xtVqas2vVlzdZr/KnTMkLHzaD56gAKehN07aQ5pzUEu4+RDLTEcz/ZfW1HuAuXMgucadH7Q+PJuAWoSRuMpCGGguA5X88wE7Fot0//5pOWaZbJneR3gjzO7KmsqESPfW8UIp/U8+t4qeUozhjoz2DioKWqW4etW1qQIPz/p5HGb/lCL6y8gyyjR0QpfY1dMg== 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: List-Subscribe: List-Unsubscribe: The SLAB implementation is going to be removed, and mm-api.rst currently uses mm/slab.c to obtain kerneldocs for some API functions. Switch it to mm/slub.c and move the relevant kerneldocs of exported functions from one to the other. The rest of kerneldocs in slab.c is for static SLAB implementation-specific functions that don't have counterparts in slub.c and thus can be simply removed with the implementation. Signed-off-by: Vlastimil Babka Acked-by: David Rientjes Reviewed-by: Hyeonggon Yoo <42.hyeyoo@gmail.com> --- Documentation/core-api/mm-api.rst | 2 +- mm/slab.c | 21 --------------------- mm/slub.c | 21 +++++++++++++++++++++ 3 files changed, 22 insertions(+), 22 deletions(-) diff --git a/Documentation/core-api/mm-api.rst b/Documentation/core-api/mm-api.rst index 2d091c873d1e..af8151db88b2 100644 --- a/Documentation/core-api/mm-api.rst +++ b/Documentation/core-api/mm-api.rst @@ -37,7 +37,7 @@ The Slab Cache .. kernel-doc:: include/linux/slab.h :internal: -.. kernel-doc:: mm/slab.c +.. kernel-doc:: mm/slub.c :export: .. kernel-doc:: mm/slab_common.c diff --git a/mm/slab.c b/mm/slab.c index 9ad3d0f2d1a5..37efe3241f9c 100644 --- a/mm/slab.c +++ b/mm/slab.c @@ -3491,19 +3491,6 @@ int kmem_cache_alloc_bulk(struct kmem_cache *s, gfp_t flags, size_t size, } EXPORT_SYMBOL(kmem_cache_alloc_bulk); -/** - * kmem_cache_alloc_node - Allocate an object on the specified node - * @cachep: The cache to allocate from. - * @flags: See kmalloc(). - * @nodeid: node number of the target node. - * - * Identical to kmem_cache_alloc but it will allocate memory on the given - * node, which can improve the performance for cpu bound structures. - * - * Fallback to other node is possible if __GFP_THISNODE is not set. - * - * Return: pointer to the new object or %NULL in case of error - */ void *kmem_cache_alloc_node(struct kmem_cache *cachep, gfp_t flags, int nodeid) { void *ret = slab_alloc_node(cachep, NULL, flags, nodeid, cachep->object_size, _RET_IP_); @@ -3564,14 +3551,6 @@ void __kmem_cache_free(struct kmem_cache *cachep, void *objp, __do_kmem_cache_free(cachep, objp, caller); } -/** - * kmem_cache_free - Deallocate an object - * @cachep: The cache the allocation was from. - * @objp: The previously allocated object. - * - * Free an object which was previously allocated from this - * cache. - */ void kmem_cache_free(struct kmem_cache *cachep, void *objp) { cachep = cache_from_obj(cachep, objp); diff --git a/mm/slub.c b/mm/slub.c index 63d281dfacdb..3e01731783df 100644 --- a/mm/slub.c +++ b/mm/slub.c @@ -3518,6 +3518,19 @@ void *__kmem_cache_alloc_node(struct kmem_cache *s, gfp_t gfpflags, caller, orig_size); } +/** + * kmem_cache_alloc_node - Allocate an object on the specified node + * @s: The cache to allocate from. + * @gfpflags: See kmalloc(). + * @node: node number of the target node. + * + * Identical to kmem_cache_alloc but it will allocate memory on the given + * node, which can improve the performance for cpu bound structures. + * + * Fallback to other node is possible if __GFP_THISNODE is not set. + * + * Return: pointer to the new object or %NULL in case of error + */ void *kmem_cache_alloc_node(struct kmem_cache *s, gfp_t gfpflags, int node) { void *ret = slab_alloc_node(s, NULL, gfpflags, node, _RET_IP_, s->object_size); @@ -3822,6 +3835,14 @@ void __kmem_cache_free(struct kmem_cache *s, void *x, unsigned long caller) slab_free(s, virt_to_slab(x), x, NULL, &x, 1, caller); } +/** + * kmem_cache_free - Deallocate an object + * @s: The cache the allocation was from. + * @x: The previously allocated object. + * + * Free an object which was previously allocated from this + * cache. + */ void kmem_cache_free(struct kmem_cache *s, void *x) { s = cache_from_obj(s, x);