Commit a7f40cf
mm: mempolicy: make mbind() return -EIO when MPOL_MF_STRICT is specified
When MPOL_MF_STRICT was specified and an existing page was already on a
node that does not follow the policy, mbind() should return -EIO. But
commit 6f4576e ("mempolicy: apply page table walker on
queue_pages_range()") broke the rule.
And commit c863379 ("mm: mempolicy: mbind and migrate_pages support
thp migration") didn't return the correct value for THP mbind() too.
If MPOL_MF_STRICT is set, ignore vma_migratable() to make sure it
reaches queue_pages_to_pte_range() or queue_pages_pmd() to check if an
existing page was already on a node that does not follow the policy.
And, non-migratable vma may be used, return -EIO too if MPOL_MF_MOVE or
MPOL_MF_MOVE_ALL was specified.
Tested with https://github.com/metan-ucw/ltp/blob/master/testcases/kernel/syscalls/mbind/mbind02.c
[[email protected]: tweak code comment]
Link: http://lkml.kernel.org/r/[email protected]
Fixes: 6f4576e ("mempolicy: apply page table walker on queue_pages_range()")
Signed-off-by: Yang Shi <[email protected]>
Signed-off-by: Oscar Salvador <[email protected]>
Reported-by: Cyril Hrubis <[email protected]>
Suggested-by: Kirill A. Shutemov <[email protected]>
Acked-by: Rafael Aquini <[email protected]>
Reviewed-by: Oscar Salvador <[email protected]>
Acked-by: David Rientjes <[email protected]>
Cc: Vlastimil Babka <[email protected]>
Cc: <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>1 parent a953e77 commit a7f40cf
1 file changed
+33
-7
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
428 | 428 | | |
429 | 429 | | |
430 | 430 | | |
| 431 | + | |
| 432 | + | |
| 433 | + | |
| 434 | + | |
| 435 | + | |
| 436 | + | |
| 437 | + | |
431 | 438 | | |
432 | 439 | | |
433 | 440 | | |
| |||
437 | 444 | | |
438 | 445 | | |
439 | 446 | | |
440 | | - | |
| 447 | + | |
441 | 448 | | |
442 | 449 | | |
443 | 450 | | |
| |||
454 | 461 | | |
455 | 462 | | |
456 | 463 | | |
457 | | - | |
| 464 | + | |
| 465 | + | |
| 466 | + | |
| 467 | + | |
| 468 | + | |
| 469 | + | |
458 | 470 | | |
| 471 | + | |
| 472 | + | |
459 | 473 | | |
460 | 474 | | |
461 | 475 | | |
| |||
480 | 494 | | |
481 | 495 | | |
482 | 496 | | |
483 | | - | |
| 497 | + | |
484 | 498 | | |
| 499 | + | |
| 500 | + | |
485 | 501 | | |
486 | 502 | | |
487 | 503 | | |
| |||
502 | 518 | | |
503 | 519 | | |
504 | 520 | | |
505 | | - | |
| 521 | + | |
| 522 | + | |
| 523 | + | |
| 524 | + | |
| 525 | + | |
| 526 | + | |
506 | 527 | | |
507 | 528 | | |
508 | 529 | | |
509 | | - | |
| 530 | + | |
510 | 531 | | |
511 | 532 | | |
512 | 533 | | |
| |||
576 | 597 | | |
577 | 598 | | |
578 | 599 | | |
579 | | - | |
| 600 | + | |
| 601 | + | |
| 602 | + | |
| 603 | + | |
| 604 | + | |
| 605 | + | |
580 | 606 | | |
581 | 607 | | |
582 | 608 | | |
| |||
603 | 629 | | |
604 | 630 | | |
605 | 631 | | |
606 | | - | |
| 632 | + | |
607 | 633 | | |
608 | 634 | | |
609 | 635 | | |
| |||
0 commit comments