Commit 4988fe69 authored by Liu Shixin's avatar Liu Shixin Committed by Andrew Morton

mm/memcontrol: use kstrtobool for swapaccount param parsing

Use kstrtobool which is more powerful to handle all kinds of parameters
like 'Yy1Nn0' or [oO][NnFf] for "on" and "off".

Link: https://lkml.kernel.org/r/20220913071358.1812206-1-liushixin2@huawei.comSigned-off-by: default avatarLiu Shixin <liushixin2@huawei.com>
Acked-by: default avatarMichal Hocko <mhocko@suse.com>
Cc: Johannes Weiner <hannes@cmpxchg.org>
Cc: Jonathan Corbet <corbet@lwn.net>
Cc: Kefeng Wang <wangkefeng.wang@huawei.com>
Cc: Muchun Song <songmuchun@bytedance.com>
Cc: Roman Gushchin <roman.gushchin@linux.dev>
Cc: Shakeel Butt <shakeelb@google.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
parent 29454cf6
......@@ -7507,10 +7507,10 @@ bool mem_cgroup_swap_full(struct folio *folio)
static int __init setup_swap_account(char *s)
{
if (!strcmp(s, "1"))
cgroup_memory_noswap = false;
else if (!strcmp(s, "0"))
cgroup_memory_noswap = true;
bool res;
if (!kstrtobool(s, &res))
cgroup_memory_noswap = !res;
return 1;
}
__setup("swapaccount=", setup_swap_account);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment