[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <b113075a-0efb-4a14-b201-54cd2f04a0cf@intel.com>
Date: Wed, 7 May 2025 20:36:12 -0700
From: Reinette Chatre <reinette.chatre@...el.com>
To: Tony Luck <tony.luck@...el.com>, Fenghua Yu <fenghuay@...dia.com>, "Maciej
Wieczor-Retman" <maciej.wieczor-retman@...el.com>, Peter Newman
<peternewman@...gle.com>, James Morse <james.morse@....com>, Babu Moger
<babu.moger@....com>, Drew Fustini <dfustini@...libre.com>, Dave Martin
<Dave.Martin@....com>, Anil Keshavamurthy <anil.s.keshavamurthy@...el.com>,
Chen Yu <yu.c.chen@...el.com>
CC: <x86@...nel.org>, <linux-kernel@...r.kernel.org>,
<patches@...ts.linux.dev>
Subject: Re: [PATCH v4 07/31] x86,fs/resctrl: Improve domain type checking
Hi Tony,
On 4/28/25 5:33 PM, Tony Luck wrote:
>
> +static inline bool check_domain_header(struct rdt_domain_hdr *hdr,
> + enum resctrl_domain_type type,
> + enum resctrl_res_level rid)
> +{
> + return !!WARN_ON_ONCE(hdr->type != type || hdr->rid != rid);
> +}
> +
Please name the function to make the resulting code easier to read. With
a name like "check_domain_header()" it is not obvious what a return of "true"
or "false" means. In this implementation "true" means that the header is
*invalid* so a "pass" of this check means that the header is invalid? This
sounds very confusing to me.
Names like "domain_header_valid()", or "domain_header_is_valid()" makes
the resulting code much easier to understand. Please do make it a goal
to make this work easy to understand, this series is complex.
Reinette
Powered by blists - more mailing lists