On Wed, Aug 03, 2022 at 08:56:44PM +0800, Michal Hocko wrote: > On Thu 04-08-22 04:43:06, Feng Tang wrote: > > On Wed, Aug 03, 2022 at 07:28:59PM +0800, Michal Hocko wrote: > [...] > > > +struct mempolicy *policy_mbind_nodemask(gfp_t gfp) > > > +{ > > > +#ifdef CONFIG_MEMPOLICY > > > + struct mempolicy *mpol = get_task_policy(current); > > > + > > > + /* > > > + * only enforce MBIND which overlaps with cpuset policy (from policy_nodemask) > > > + * specifically for hugetlb case > > > + */ > > > + if (mpol->mode == MPOL_BIND && > > > + (apply_policy_zone(mpol, gfp_zone(gfp)) && > > > + cpuset_nodemask_valid_mems_allowed(&policy->nodes)) > > > + return &mpol->nodes; > > > +#endif > > > + return NULL; > > > > I saw the logic is not changed, and it confused me that if there is > > no qualified node, it will still return NULL which effectively equals > > node_states[N_MEMORY], while I think it should return a all zero > > nodemasks. > > This is a separate thing and I have to admit that the existing code is > rather non-intuitive or even broken. I guess we do not care all that > much because MBIND with completely non-overlapping cpusets is just a > broken configuration. I am not sure this case is interesting or even > supported. Fair enough, and moving the policy_mbind_nodemask() into hugetlb.c for one single caller make it much less severe. Do we still need the other nodemask API I proposed earlier which has no parameter of gfp_flag, and used for __nr_hugepages_store_common? Thanks, Feng > -- > Michal Hocko > SUSE Labs >