From: Zhongkun He <hezhongkun.hzk@bytedance.com>
To: "Huang, Ying" <ying.huang@intel.com>
Cc: corbet@lwn.net, mhocko@suse.com, akpm@linux-foundation.org,
linux-mm@kvack.org, linux-kernel@vger.kernel.org,
linux-api@vger.kernel.org, linux-doc@vger.kernel.org
Subject: Re: [External] Re: [PATCH v2] mm: add new syscall pidfd_set_mempolicy().
Date: Wed, 16 Nov 2022 17:38:09 +0800 [thread overview]
Message-ID: <0445de39-15a4-f645-b380-39f20abb6524@bytedance.com> (raw)
In-Reply-To: <87zgcrwfac.fsf@yhuang6-desk2.ccr.corp.intel.com>
Hi Ying, thanks for your replay and suggestions.
>
> I suggest to move the flags in "mode" parameter (MPOL_F_STATIC_NODES,
> MPOL_F_RELATIVE_NODES, MPOL_F_NUMA_BALANCING, etc.) to "flags"
> parameter, otherwise, why add it?
The "flags" is used for future extension if any, just like
process_madvise() and set_mempolicy_home_node().
Maybe it should be removed.
>
> And, how about add a "home_node" parameter? I don't think that it's a
> good idea to add another new syscall for pidfd_set_mempolicy_home_node()
> in the future.
>
Good idea, but "home_node" is used for vma policy, not task policy.
It is possible to use it in pidfd_mbind() in the future.
>
> IMHO, "The first four APIS" and "The last one" isn't easy to be
> understood. How about
>
> "sys_pidfd_set_mempolicy sets the mempolicy of task specified in the
> pidfd, the others affect only the calling task, ...".
>
Got it.
>
> Why add "sys_"? I fount that there's no "sys_" before set_mempolicy()/mbind() etc.
>
Got it.
>> +void mpol_put_async(struct task_struct *task, struct mempolicy *p)
>
> How about change __mpol_put() directly?
>
> Why can we fall back to freeing directly if task_work_add() failed?
> Should we check the return code and fall back only if -ESRCH and WARN
> for other cases?
>
A task_work based solution has not been accepted yet, it will be
considered later if needed.
>> + }
>
> Why do we need to write lock mmap_sem? IIUC, we don't touch vma.
>
Yes, it should be removed.
>> /*
>
> Because we will change task_struct->mempolicy in another task, we need
> to use kind of "load acquire" / "store release" memory order. For
> example, rcu_dereference() / rcu_assign_pointer(), etc.
>
Thanks again for your suggestion.
Best Regards,
Zhongkun
next prev parent reply other threads:[~2022-11-16 9:38 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-11-11 8:40 Zhongkun He
2022-11-11 19:27 ` Andrew Morton
2022-11-13 16:41 ` [External] " Zhongkun He
2022-11-14 11:44 ` Michal Hocko
2022-11-14 11:46 ` Michal Hocko
2022-11-14 17:52 ` Michal Hocko
2022-11-14 15:12 ` Zhongkun He
2022-11-14 18:12 ` Michal Hocko
2022-11-15 7:39 ` Zhongkun He
2022-11-16 11:28 ` Zhongkun He
2022-11-16 14:57 ` Michal Hocko
2022-11-17 7:19 ` Zhongkun He
2022-11-21 14:38 ` Michal Hocko
2022-11-22 8:33 ` Zhongkun He
2022-11-22 8:40 ` Michal Hocko
2022-11-14 9:24 ` Zhongkun He
2022-11-12 2:09 ` kernel test robot
2022-11-16 7:04 ` Huang, Ying
2022-11-16 9:38 ` Zhongkun He [this message]
2022-11-16 9:44 ` [External] " Michal Hocko
2022-11-17 6:29 ` Huang, Ying
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=0445de39-15a4-f645-b380-39f20abb6524@bytedance.com \
--to=hezhongkun.hzk@bytedance.com \
--cc=akpm@linux-foundation.org \
--cc=corbet@lwn.net \
--cc=linux-api@vger.kernel.org \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mhocko@suse.com \
--cc=ying.huang@intel.com \
/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