linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Rong Tao <rtoax@foxmail.com>
To: 42.hyeyoo@gmail.com
Cc: akpm@linux-foundation.org, cl@linux.com, iamjoonsoo.kim@lge.com,
	linux-kernel@vger.kernel.org, linux-mm@kvack.org,
	penberg@kernel.org, rientjes@google.com,
	roman.gushchin@linux.dev, rongtao@cestc.cn, rtoax@foxmail.com,
	sdf@google.com, vbabka@suse.cz, yhs@fb.com
Subject: Re: [PATCH] mm: Functions used internally should not be put into
Date: Tue, 17 Jan 2023 10:01:21 +0800	[thread overview]
Message-ID: <tencent_6238B3302FB554EC5EEF475F11470C048509@qq.com> (raw)
In-Reply-To: <Y8U8OfoVwkJPdJcv@localhost>

Hi, dear Hyeonggon.

If sl*b_def.h is not intended to be used externally. That is to say we should
never include sl*b_def.h in module? The following code will not compile success
since commit 40f3bf0cb04c("mm: Convert struct page to struct slab in functions
used by other subsystems"), but success in older kernel. Especially for modules
that use the kmem_cache structure, this is catastrophic.

	#include <linux/init.h>
	#include <linux/printk.h>
	#include <linux/slab.h>
	#include <linux/slab_def.h>

	static int kernel_init(void)
	{
		printk(KERN_INFO "my init.\n");
		return 0;
	}

	static void kernel_exit(void)
	{
		printk(KERN_INFO "my exit.\n");
	}

	module_init(kernel_init);
	module_exit(kernel_exit);

You are right, if sl*b_def.h is not intended to used externally, Modules that
use kmem_cache structures should not be designed from the outset to use
kmem_cache structures. Or the kernel can use this patch, and these modules can
be compiled successfully.

Best wishes.

Rong Tao


  reply	other threads:[~2023-01-17  2:01 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-16  8:50 [PATCH] mm: Functions used internally should not be put into slub_def.h Rong Tao
2023-01-16 11:59 ` Hyeonggon Yoo
2023-01-17  2:01   ` Rong Tao [this message]
2023-01-17 12:57     ` [PATCH] mm: Functions used internally should not be put into Vlastimil Babka
2023-01-18  7:23       ` Rong Tao
2023-01-21 20:34         ` Yonghong Song

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=tencent_6238B3302FB554EC5EEF475F11470C048509@qq.com \
    --to=rtoax@foxmail.com \
    --cc=42.hyeyoo@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=cl@linux.com \
    --cc=iamjoonsoo.kim@lge.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=penberg@kernel.org \
    --cc=rientjes@google.com \
    --cc=roman.gushchin@linux.dev \
    --cc=rongtao@cestc.cn \
    --cc=sdf@google.com \
    --cc=vbabka@suse.cz \
    --cc=yhs@fb.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox