[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20200116191609.3972fd5301cf364a27381923@linux-foundation.org>
Date: Thu, 16 Jan 2020 19:16:09 -0800
From: Andrew Morton <akpm@...ux-foundation.org>
To: David Rientjes <rientjes@...gle.com>
Cc: Mel Gorman <mgorman@...hsingularity.net>,
Vlastimil Babka <vbabka@...e.cz>, linux-kernel@...r.kernel.org,
linux-mm@...ck.org
Subject: Re: [patch] mm, thp: fix defrag setting if newline is not used
On Tue, 14 Jan 2020 17:58:36 -0800 (PST) David Rientjes <rientjes@...gle.com> wrote:
> If thp defrag setting "defer" is used and a newline is *not* used when
> writing to the sysfs file, this is interpreted as the "defer+madvise"
> option.
>
> This is because we do prefix matching and if five characters are written
> without a newline, the current code ends up comparing to the first five
> bytes of the "defer+madvise" option and using that instead.
>
> Find the length of what the user is writing and use that to guide our
> decision on which string comparison to do.
Gee, why is this code so complicated? Can't we just do
if (sysfs_streq(buf, "always")) {
...
} else if sysfs_streq(buf, "defer+madvise")) {
...
}
...
Powered by blists - more mailing lists