lkml.org 
[lkml]   [2023]   [Nov]   [28]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    Date
    From
    SubjectRe: [RFC PATCH 06/11] mm/mempolicy: modify do_mbind to operate on task argument instead of current
    On Wed 22-11-23 16:11:55, Gregory Price wrote:
    [...]
    > + * Like get_vma_policy and get_task_policy, must hold alloc/task_lock
    > + * while calling this.
    > + */
    > +static struct mempolicy *get_task_vma_policy(struct task_struct *task,
    > + struct vm_area_struct *vma,
    > + unsigned long addr, int order,
    > + pgoff_t *ilx)
    [...]

    You should add lockdep annotation for alloc_lock/task_lock here for clarity and
    also...
    > @@ -1844,16 +1899,7 @@ struct mempolicy *__get_vma_policy(struct vm_area_struct *vma,
    > struct mempolicy *get_vma_policy(struct vm_area_struct *vma,
    > unsigned long addr, int order, pgoff_t *ilx)
    > {
    > - struct mempolicy *pol;
    > -
    > - pol = __get_vma_policy(vma, addr, ilx);
    > - if (!pol)
    > - pol = get_task_policy(current);
    > - if (pol->mode == MPOL_INTERLEAVE) {
    > - *ilx += vma->vm_pgoff >> order;
    > - *ilx += (addr - vma->vm_start) >> (PAGE_SHIFT + order);
    > - }
    > - return pol;
    > + return get_task_vma_policy(current, vma, addr, order, ilx);

    I do not think that all get_vma_policy take task_lock (just random check
    dequeue_hugetlb_folio_vma->huge_node->get_vma_policy AFAICS)

    Also I do not see policy_nodemask to be handled anywhere. That one is
    used along with get_vma_policy (sometimes hidden like in
    alloc_pages_mpol). It has a dependency on
    cpuset_nodemask_valid_mems_allowed. That means that e.g. mbind on a
    remote task would be constrained by current task cpuset when allocating
    migration targets for the target task. I am wondering how many other
    dependencies like that are lurking there.
    --
    Michal Hocko
    SUSE Labs

    \
     
     \ /
      Last update: 2023-11-28 15:13    [W:2.225 / U:0.056 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site