All of lore.kernel.org
 help / color / mirror / Atom feed
From: Oscar Salvador <osalvador@suse.de>
To: "Kirill A. Shutemov" <kirill@shutemov.name>
Cc: Yang Shi <shy828301@gmail.com>, Cyril Hrubis <chrubis@suse.cz>,
	Linux MM <linux-mm@kvack.org>,
	linux-api@vger.kernel.org, ltp@lists.linux.it,
	Vlastimil Babka <vbabka@suse.cz>,
	kirill.shutemov@linux.intel.com
Subject: Re: mbind() fails to fail with EIO
Date: Tue, 19 Mar 2019 15:41:33 +0100	[thread overview]
Message-ID: <20190319144130.lidqtrkfl75n2haj@d104.suse.de> (raw)
In-Reply-To: <20190319142639.wbind5smqcji264l@kshutemo-mobl1>

On Tue, Mar 19, 2019 at 05:26:39PM +0300, Kirill A. Shutemov wrote:
> That's all sounds reasonable.
> 
> We only need to make sure the bug fixed by 77bf45e78050 will not be
> re-introduced.

I gave it a spin with the below patch.
Your testcase works (so the bug is not re-introduced), and we get -EIO
when running the ltp test [1].
So unless I am missing something, it should be enough.

diff --git a/mm/mempolicy.c b/mm/mempolicy.c
index af171ccb56a2..b192b13460f0 100644
--- a/mm/mempolicy.c
+++ b/mm/mempolicy.c
@@ -502,11 +508,16 @@ static int queue_pages_pte_range(pmd_t *pmd, unsigned long addr,
                        continue;
                if (!queue_pages_required(page, qp))
                        continue;
-               migrate_page_add(page, qp->pagelist, flags);
+               if (flags & (MPOL_MF_MOVE | MPOL_MF_MOVE_ALL))
+                       migrate_page_add(page, qp->pagelist, flags);
+               else
+                       break;
        }
        pte_unmap_unlock(pte - 1, ptl);
        cond_resched();
-       return 0;
+       return addr != end ? -EIO : 0;
 }

 static int queue_pages_hugetlb(pte_t *pte, unsigned long hmask,
@@ -603,7 +614,8 @@ static int queue_pages_test_walk(unsigned long start, unsigned long end,
        }

        /* queue pages from current vma */
-       if (flags & (MPOL_MF_MOVE | MPOL_MF_MOVE_ALL))
+       if ((flags & MPOL_MF_STRICT) ||
+               (flags & (MPOL_MF_MOVE | MPOL_MF_MOVE_ALL))
                return 0;
  

[1] https://github.com/metan-ucw/ltp/blob/master/testcases/kernel/syscalls/mbind/mbind02.c

-- 
Oscar Salvador
SUSE L3


WARNING: multiple messages have this Message-ID (diff)
From: Oscar Salvador <osalvador@suse.de>
To: ltp@lists.linux.it
Subject: [LTP] mbind() fails to fail with EIO
Date: Tue, 19 Mar 2019 15:41:33 +0100	[thread overview]
Message-ID: <20190319144130.lidqtrkfl75n2haj@d104.suse.de> (raw)
In-Reply-To: <20190319142639.wbind5smqcji264l@kshutemo-mobl1>

On Tue, Mar 19, 2019 at 05:26:39PM +0300, Kirill A. Shutemov wrote:
> That's all sounds reasonable.
> 
> We only need to make sure the bug fixed by 77bf45e78050 will not be
> re-introduced.

I gave it a spin with the below patch.
Your testcase works (so the bug is not re-introduced), and we get -EIO
when running the ltp test [1].
So unless I am missing something, it should be enough.

diff --git a/mm/mempolicy.c b/mm/mempolicy.c
index af171ccb56a2..b192b13460f0 100644
--- a/mm/mempolicy.c
+++ b/mm/mempolicy.c
@@ -502,11 +508,16 @@ static int queue_pages_pte_range(pmd_t *pmd, unsigned long addr,
                        continue;
                if (!queue_pages_required(page, qp))
                        continue;
-               migrate_page_add(page, qp->pagelist, flags);
+               if (flags & (MPOL_MF_MOVE | MPOL_MF_MOVE_ALL))
+                       migrate_page_add(page, qp->pagelist, flags);
+               else
+                       break;
        }
        pte_unmap_unlock(pte - 1, ptl);
        cond_resched();
-       return 0;
+       return addr != end ? -EIO : 0;
 }

 static int queue_pages_hugetlb(pte_t *pte, unsigned long hmask,
@@ -603,7 +614,8 @@ static int queue_pages_test_walk(unsigned long start, unsigned long end,
        }

        /* queue pages from current vma */
-       if (flags & (MPOL_MF_MOVE | MPOL_MF_MOVE_ALL))
+       if ((flags & MPOL_MF_STRICT) ||
+               (flags & (MPOL_MF_MOVE | MPOL_MF_MOVE_ALL))
                return 0;
  

[1] https://github.com/metan-ucw/ltp/blob/master/testcases/kernel/syscalls/mbind/mbind02.c

-- 
Oscar Salvador
SUSE L3

  parent reply	other threads:[~2019-03-19 14:41 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-03-15 16:01 mbind() fails to fail with EIO Cyril Hrubis
2019-03-15 16:01 ` [LTP] " Cyril Hrubis
2019-03-18 16:08 ` Qian Cai
2019-03-18 16:08   ` [LTP] " Qian Cai
2019-03-19 12:59   ` Cyril Hrubis
2019-03-19 12:59     ` [LTP] " Cyril Hrubis
2019-03-18 18:12 ` Yang Shi
2019-03-18 18:12   ` [LTP] " Yang Shi
2019-03-19 13:27   ` Oscar Salvador
2019-03-19 13:27     ` [LTP] " Oscar Salvador
2019-03-19 14:26     ` Kirill A. Shutemov
2019-03-19 14:26       ` [LTP] " Kirill A. Shutemov
2019-03-19 14:30       ` Cyril Hrubis
2019-03-19 14:30         ` [LTP] " Cyril Hrubis
2019-03-19 14:41       ` Oscar Salvador [this message]
2019-03-19 14:41         ` Oscar Salvador
2019-03-19 14:52         ` Kirill A. Shutemov
2019-03-19 14:52           ` [LTP] " Kirill A. Shutemov
2019-03-19 15:10           ` Oscar Salvador
2019-03-19 15:10             ` [LTP] " Oscar Salvador
2019-03-19 16:29             ` Yang Shi
2019-03-19 16:29               ` [LTP] " Yang Shi
2019-03-19 16:25           ` Yang Shi
2019-03-19 16:25             ` [LTP] " Yang Shi

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=20190319144130.lidqtrkfl75n2haj@d104.suse.de \
    --to=osalvador@suse.de \
    --cc=chrubis@suse.cz \
    --cc=kirill.shutemov@linux.intel.com \
    --cc=kirill@shutemov.name \
    --cc=linux-api@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=ltp@lists.linux.it \
    --cc=shy828301@gmail.com \
    --cc=vbabka@suse.cz \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.