ebruakagunduz

inline attachment example

Jun 17th, 2016
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.53 KB | None | 0 0
  1. > > > + down_write(&mm->mmap_sem);
  2. > > > + result = hugepage_vma_revalidate(mm, vma, address);
  3. > > > + if (result)
  4. > > > + goto out;
  5. > > >
  6. > > > anon_vma_lock_write(vma->anon_vma);
  7. > >
  8. > > Didn't Kirill have a concern that the vma might go away after up_read
  9. > > and before down_write?
  10. >
  11. > hugepage_vma_revalidate does the revalidation. Scratch my comment. Sorry
  12. > about the noise. I just saw the vma still being used and that raised a
  13. > flag. I should have looked into hugepage_vma_revalidate to see that vma
  14. > is not actually used and it can be dropped.
  15.  
  16. One thing to notice is that passing 'vma' to hugepage_vma_revlidate() is
  17. useless. It doesn't make use of it anyway.
  18.  
  19. Fixup:
  20.  
  21. diff --git a/mm/huge_memory.c b/mm/huge_memory.c
  22. index 292cedd9d692..b17c84095059 100644
  23. --- a/mm/huge_memory.c
  24. +++ b/mm/huge_memory.c
  25. @@ -2386,10 +2386,9 @@ static bool hugepage_vma_check(struct vm_area_struct *vma)
  26. * value (scan code).
  27. */
  28.  
  29. -static int hugepage_vma_revalidate(struct mm_struct *mm,
  30. - struct vm_area_struct *vma,
  31. - unsigned long address)
  32. +static int hugepage_vma_revalidate(struct mm_struct *mm, unsigned long address)
  33. {
  34. + struct vm_area_struct *vma;
  35. unsigned long hstart, hend;
  36.  
  37. if (unlikely(khugepaged_test_exit(mm)))
  38. @@ -2438,7 +2437,7 @@ static bool __collapse_huge_page_swapin(struct mm_struct *mm,
  39. if (ret & VM_FAULT_RETRY) {
  40. down_read(&mm->mmap_sem);
  41. /* vma is no longer available, don't continue to swapin */
  42. - if (hugepage_vma_revalidate(mm, vma, address))
  43. + if (hugepage_vma_revalidate(mm, address))
  44. return false;
  45. }
  46. if (ret & VM_FAULT_ERROR) {
  47. @@ -2492,7 +2491,7 @@ static void collapse_huge_page(struct mm_struct *mm,
  48. swap = get_mm_counter(mm, MM_SWAPENTS);
  49. curr_allocstall = sum_vm_event(ALLOCSTALL);
  50. down_read(&mm->mmap_sem);
  51. - result = hugepage_vma_revalidate(mm, vma, address);
  52. + result = hugepage_vma_revalidate(mm, address);
  53. if (result)
  54. goto out;
  55.  
  56. @@ -2525,7 +2524,7 @@ static void collapse_huge_page(struct mm_struct *mm,
  57. * handled by the anon_vma lock + PG_lock.
  58. */
  59. down_write(&mm->mmap_sem);
  60. - result = hugepage_vma_revalidate(mm, vma, address);
  61. + result = hugepage_vma_revalidate(mm, address);
  62. if (result)
  63. goto out;
Advertisement
Add Comment
Please, Sign In to add comment