lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Tue, 19 Dec 2023 13:09:02 -0500
From: Gregory Price <gregory.price@...verge.com>
To: "Huang, Ying" <ying.huang@...el.com>
Cc: Gregory Price <gourry.memverge@...il.com>, linux-mm@...ck.org,
	linux-doc@...r.kernel.org, linux-fsdevel@...r.kernel.org,
	linux-kernel@...r.kernel.org, linux-api@...r.kernel.org,
	x86@...nel.org, akpm@...ux-foundation.org, arnd@...db.de,
	tglx@...utronix.de, luto@...nel.org, mingo@...hat.com, bp@...en8.de,
	dave.hansen@...ux.intel.com, hpa@...or.com, mhocko@...nel.org,
	tj@...nel.org, corbet@....net, rakie.kim@...com,
	hyeongtak.ji@...com, honggyu.kim@...com, vtavarespetr@...ron.com,
	peterz@...radead.org, jgroves@...ron.com, ravis.opensrc@...ron.com,
	sthanneeru@...ron.com, emirakhur@...ron.com, Hasan.Maruf@....com,
	seungjun.ha@...sung.com, Johannes Weiner <hannes@...xchg.org>,
	Hasan Al Maruf <hasanalmaruf@...com>, Hao Wang <haowang3@...com>,
	Dan Williams <dan.j.williams@...el.com>,
	Michal Hocko <mhocko@...e.com>,
	Zhongkun He <hezhongkun.hzk@...edance.com>,
	Frank van der Linden <fvdl@...gle.com>,
	John Groves <john@...alactic.com>,
	Jonathan Cameron <Jonathan.Cameron@...wei.com>
Subject: Re: [PATCH v4 00/11] mempolicy2, mbind2, and weighted interleave

On Tue, Dec 19, 2023 at 11:04:05AM +0800, Huang, Ying wrote:
> Gregory Price <gourry.memverge@...il.com> writes:
> 
> > This patch set extends the mempolicy interface to enable new
> > mempolicies which may require extended data to operate.
> >
> > MPOL_WEIGHTED_INTERLEAVE is included as an example extension.
> 
> Per my understanding, it's better to describe why we need this patchset
> at the beginning.  Per my understanding, weighted interleave is used to
> expand DRAM bandwidth for workloads with real high memory bandwidth
> requirements.  Without it, DRAM bandwidth will be saturated, which leads
> to poor performance.
> 

Will add more details, thanks.

> > struct mempolicy_args {
> >     unsigned short mode;            /* policy mode */
> >     unsigned short mode_flags;      /* policy mode flags */
> >     int home_node;                  /* mbind: use MPOL_MF_HOME_NODE */
> >     nodemask_t *policy_nodes;       /* get/set/mbind */
> >     unsigned char *il_weights;      /* for mode MPOL_WEIGHTED_INTERLEAVE */
> >     int policy_node;                /* get: policy node information */
> > };
> 
> Because we use more and more parameters to describe the mempolicy, I
> think it's a good idea to replace some parameters with struct.  But I
> don't think it's a good idea to put unrelated stuff into the struct.
> For example,
> 
> struct mempolicy_param {
>     unsigned short mode;            /* policy mode */
>     unsigned short mode_flags;      /* policy mode flags */
>     int home_node;                  /* mbind: use MPOL_MF_HOME_NODE */
>     nodemask_t *policy_nodes;
>     unsigned char *il_weights;      /* for mode MPOL_WEIGHTED_INTERLEAVE */
> };
> 
> describe the parameters to create the mempolicy.  It can be used by
> set/get_mempolicy() and mbind().  So, I think that it's a good
> abstraction.  But "policy_node" has nothing to do with set_mempolicy()
> and mbind().  So I think that we shouldn't add it into the struct.  It's
> totally OK to use different parameters for different functions.  For
> example,
> 
> long do_set_mempolicy(struct mempolicy_param *mparam);
> long do_mbind(unsigned long start, unsigned long len,
>                 struct mempolicy_param *mparam, unsigned long flags);
> long do_get_task_mempolicy(struct mempolicy_param *mparam, int
>                 *policy_node);
> 
> This isn't the full list.  My point is to use separate parameter for
> something specific for some function.
>

this is the internal structure, but i get the point, we can drop it from
the structure and extend the arg list internally.

I'd originally thought to just remove the policy_node stuff all
together from get_mempolicy2().  Do you prefer to have a separate struct
for set/get interfaces so that the get interface struct can be extended?

All the MPOL_F_NODE "alternate data fetch" mechanisms from
get_mempolicy() feel like more of a wart than a feature.  And presently
the only data returned in policy_node is the next allocation node for
interleave.  That's not even particularly useful, so I'm of a mind to
remove it.

Assuming we remove policy_node altogether... do we still break up the
set/get interface into separate structures to avoid this in the future?

> > struct mpol_args {
> >         /* Basic mempolicy settings */
> >         __u16 mode;
> >         __u16 mode_flags;
> >         __s32 home_node;
> >         __aligned_u64 pol_nodes;
> >         __aligned_u64 *il_weights;      /* of size pol_maxnodes */
> >         __u64 pol_maxnodes;
> >         __s32 policy_node;
> > };
> 
> Same as my idea above.  I think we shouldn't add policy_node for
> set_mempolicy2()/mbind2().  That will make users confusing.  We can use
> a different struct for get_mempolicy2().
> 

See above.

~Gregory

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ