Re: [PATCH] mm/hotplug: Enumerate memory range offlining failure reasons

From: Michal Hocko
Date: Tue Aug 18 2020 - 02:58:22 EST


On Tue 18-08-20 11:58:49, Anshuman Khandual wrote:
>
>
> On 08/18/2020 11:35 AM, Michal Hocko wrote:
> > On Tue 18-08-20 09:52:02, Anshuman Khandual wrote:
> >> Currently a debug message is printed describing the reason for memory range
> >> offline failure. This just enumerates existing reason codes which improves
> >> overall readability and makes it cleaner. This does not add any functional
> >> change.
> >
> > Wasn't something like that posted already? To be honest I do not think
>
> There was a similar one regarding bad page reason.
>
> https://patchwork.kernel.org/patch/11464713/
>
> > this is worth the additional LOC. We are talking about few strings used
> > at a single place. I really do not see any simplification, constants are
> > sometimes even longer than the strings they are describing.
>
> I am still trying to understand why enumerating all potential offline
> failure reasons in a single place (i.e via enum) is not a better idea
> than strings scattered across the function. Besides being cleaner, it
> classifies, organizes and provide a structure to the set of reasons.
> It is not just about string replacement with constants.

This is a matter of taste. I would agree that using constants to
reference standardized messages is a good idea but all these reasons
are just an ad-hoc messages that we want to print more or less as a
debugging output. So all the additional LOC don't really seem worth it.
--
Michal Hocko
SUSE Labs