linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: "Huang, Ying" <ying.huang@intel.com>
To: Gregory Price <gregory.price@memverge.com>
Cc: Gregory Price <gourry.memverge@gmail.com>,  <linux-mm@kvack.org>,
	<linux-doc@vger.kernel.org>,  <linux-fsdevel@vger.kernel.org>,
	<linux-kernel@vger.kernel.org>,  <linux-api@vger.kernel.org>,
	<x86@kernel.org>,  <akpm@linux-foundation.org>,  <arnd@arndb.de>,
	<tglx@linutronix.de>,  <luto@kernel.org>,  <mingo@redhat.com>,
	<bp@alien8.de>,  <dave.hansen@linux.intel.com>,  <hpa@zytor.com>,
	<mhocko@kernel.org>,  <tj@kernel.org>,  <corbet@lwn.net>,
	<rakie.kim@sk.com>,  <hyeongtak.ji@sk.com>,  <honggyu.kim@sk.com>,
	<vtavarespetr@micron.com>,  <peterz@infradead.org>,
	<jgroves@micron.com>,  <ravis.opensrc@micron.com>,
	<sthanneeru@micron.com>,  <emirakhur@micron.com>,
	 <Hasan.Maruf@amd.com>, <seungjun.ha@samsung.com>,
	 Johannes Weiner <hannes@cmpxchg.org>,
	 Hasan Al Maruf <hasanalmaruf@fb.com>,
	 Hao Wang <haowang3@fb.com>,
	 Dan Williams <dan.j.williams@intel.com>,
	 "Michal Hocko" <mhocko@suse.com>,
	 Zhongkun He <hezhongkun.hzk@bytedance.com>,
	 "Frank van der Linden" <fvdl@google.com>,
	 John Groves <john@jagalactic.com>,
	 Jonathan Cameron <Jonathan.Cameron@huawei.com>
Subject: Re: [PATCH v4 00/11] mempolicy2, mbind2, and weighted interleave
Date: Wed, 20 Dec 2023 10:27:06 +0800	[thread overview]
Message-ID: <87zfy5libp.fsf@yhuang6-desk2.ccr.corp.intel.com> (raw)
In-Reply-To: <ZYHcPiU2IzHr/tbQ@memverge.com> (Gregory Price's message of "Tue, 19 Dec 2023 13:09:02 -0500")

Gregory Price <gregory.price@memverge.com> writes:

> On Tue, Dec 19, 2023 at 11:04:05AM +0800, Huang, Ying wrote:
>> Gregory Price <gourry.memverge@gmail.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?

I have no much experience at ABI definition.  So, I want to get guidance
from more experienced people on this.

Is it good to implement all functionality of get_mempolicy() with
get_mempolicy2(), so we can deprecate get_mempolicy() and remove it
finally?  So, users don't need to use 2 similar syscalls?

And, IIUC, we will not get policy_node, addr_node, and policy config at
the same time, is it better to use a union instead of struct in
get_mempolicy2()?

>> > 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.

--
Best Regards,
Huang, Ying


  reply	other threads:[~2023-12-20  2:29 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-18 19:46 Gregory Price
2023-12-18 19:46 ` [PATCH v4 07/11] mm/mempolicy: add userland mempolicy arg structure Gregory Price
2023-12-18 19:46 ` [PATCH v4 10/11] mm/mempolicy: add the mbind2 syscall Gregory Price
2023-12-19 12:24   ` kernel test robot
2023-12-20  0:48   ` kernel test robot
2023-12-19  3:04 ` [PATCH v4 00/11] mempolicy2, mbind2, and weighted interleave Huang, Ying
2023-12-19 18:09   ` Gregory Price
2023-12-20  2:27     ` Huang, Ying [this message]
2023-12-26  7:26       ` Gregory Price
2024-01-02  4:08         ` Huang, Ying
     [not found] ` <20231218194631.21667-12-gregory.price@memverge.com>
2023-12-19  3:07   ` [PATCH v4 11/11] mm/mempolicy: extend set_mempolicy2 and mbind2 to support " Huang, Ying
2023-12-19 18:12     ` Gregory Price
2024-01-03 11:16   ` Dan Carpenter

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87zfy5libp.fsf@yhuang6-desk2.ccr.corp.intel.com \
    --to=ying.huang@intel.com \
    --cc=Hasan.Maruf@amd.com \
    --cc=Jonathan.Cameron@huawei.com \
    --cc=akpm@linux-foundation.org \
    --cc=arnd@arndb.de \
    --cc=bp@alien8.de \
    --cc=corbet@lwn.net \
    --cc=dan.j.williams@intel.com \
    --cc=dave.hansen@linux.intel.com \
    --cc=emirakhur@micron.com \
    --cc=fvdl@google.com \
    --cc=gourry.memverge@gmail.com \
    --cc=gregory.price@memverge.com \
    --cc=hannes@cmpxchg.org \
    --cc=haowang3@fb.com \
    --cc=hasanalmaruf@fb.com \
    --cc=hezhongkun.hzk@bytedance.com \
    --cc=honggyu.kim@sk.com \
    --cc=hpa@zytor.com \
    --cc=hyeongtak.ji@sk.com \
    --cc=jgroves@micron.com \
    --cc=john@jagalactic.com \
    --cc=linux-api@vger.kernel.org \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=luto@kernel.org \
    --cc=mhocko@kernel.org \
    --cc=mhocko@suse.com \
    --cc=mingo@redhat.com \
    --cc=peterz@infradead.org \
    --cc=rakie.kim@sk.com \
    --cc=ravis.opensrc@micron.com \
    --cc=seungjun.ha@samsung.com \
    --cc=sthanneeru@micron.com \
    --cc=tglx@linutronix.de \
    --cc=tj@kernel.org \
    --cc=vtavarespetr@micron.com \
    --cc=x86@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox