Re: [PATCH 03/12] mm: shmem: don't expose 'deny' and 'force' via the kernel command line
From: Barry Song
Date: Fri Sep 18 2026 - 01:45:50 EST
On Fri, Sep 18, 2026 at 11:58 AM Baolin Wang
<baolin.wang@xxxxxxxxxxxxxxxxx> wrote:
>
> Based on the previous discussion with Lorenzo[1], the 'deny' and 'force'
> options are testing-only configurations and shouldn't be exposed via the
> shmem kernel command line.
>
> So drop these debug options from the shmem kernel command line and update
> the documentation to make this clear.
If it is a debug option, it should not be exposed through sysfs :-)
Maybe we could rephrase this to say that it can only be switched at
runtime through the `shmem_enabled` sysfs interface?
>
> [1] https://lore.kernel.org/all/6e4aae7b-2c71-4109-945c-6481efde3636@xxxxxxxxxxxxxxxxx/
> Suggested-by: Lorenzo Stoakes (ARM) <ljs@xxxxxxxxxx>
> Signed-off-by: Baolin Wang <baolin.wang@xxxxxxxxxxxxxxxxx>
> ---
[...]
> +static int shmem_parse_huge(const char *str, bool skip_deny_force)
> {
The name is a bit weird. What about `allow_deny_force`?
> int huge;
>
> @@ -683,9 +683,9 @@ static int shmem_parse_huge(const char *str)
> huge = SHMEM_HUGE_WITHIN_SIZE;
> else if (!strcmp(str, "advise"))
> huge = SHMEM_HUGE_ADVISE;
> - else if (!strcmp(str, "deny"))
> + else if (!strcmp(str, "deny") && !skip_deny_force)
> huge = SHMEM_HUGE_DENY;
> - else if (!strcmp(str, "force"))
> + else if (!strcmp(str, "force") && !skip_deny_force)
> huge = SHMEM_HUGE_FORCE;
> else
> return -EINVAL;
> @@ -5680,7 +5680,7 @@ static ssize_t shmem_enabled_store(struct kobject *kobj,
> if (count && tmp[count - 1] == '\n')
> tmp[count - 1] = '\0';
>
> - huge = shmem_parse_huge(tmp);
> + huge = shmem_parse_huge(tmp, /*skip_deny_force=*/false);
/*allow_deny_force=*/true
> if (huge == -EINVAL)
> return huge;
>
> @@ -5807,7 +5807,7 @@ static int __init setup_transparent_hugepage_shmem(char *str)
> {
> int huge;
>
> - huge = shmem_parse_huge(str);
> + huge = shmem_parse_huge(str, /*skip_deny_force=*/true);
/*allow_deny_force=*/false
> if (huge == -EINVAL) {
> pr_warn("transparent_hugepage_shmem= cannot parse, ignored\n");
> return huge;
> @@ -5822,7 +5822,7 @@ static int __init setup_transparent_hugepage_tmpfs(char *str)
> {
> int huge;
>
> - huge = shmem_parse_huge(str);
> + huge = shmem_parse_huge(str, /*skip_deny_force=*/true);
/*allow_deny_force=*/false
> if (huge < 0) {
> pr_warn("transparent_hugepage_tmpfs= cannot parse, ignored\n");
> return huge;
> --
> 2.47.3
>
Best Regards
Barry