Skip to contentSkip to conversation

mm: postpone page table allocation until we have page to map

DISCUSSION Dan Carpenter 2 participants 2 messages Jun 11, 2016

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

Hello Kirill A. Shutemov,

The patch 78d5e6079a91: "mm: postpone page table allocation until we have page to map" from Jun 9, 2016, leads to the following static checker warning:

	mm/memory.c:3175 do_fault_around()
	warn: if statement not indented

mm/memory.c

  3167          /* check if the page fault is solved */
  3168          fe->pte -= (fe->address >> PAGE_SHIFT) - (address >> PAGE_SHIFT);
  3169          if (!pte_none(*fe->pte)) {
  3170                  /*
  3171                   * Faultaround produce old pte, but the pte we've
  3172                   * handler fault for should be young.
  3173                   */

3174 pte_t entry = pte_mkyoung(*fe->pte);
3175 if (ptep_set_access_flags(fe->vma, fe->address, fe->pte,
3176 entry, 0))

What's going on here? Should the next line be indented?

  3177                  update_mmu_cache(fe->vma, fe->address, fe->pte);
  3178                  ret = VM_FAULT_NOPAGE;
  3179          }
  3180          pte_unmap_unlock(fe->pte, fe->ptl);
  3181  out:
  3182          fe->address = address;
  3183          fe->pte = NULL;
  3184          return ret;
  3185  }

regards,
dan carpenter

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>

#1 lore raw
Quoted 17 lines · Dan Carpenter

Hello Kirill A. Shutemov,

The patch 78d5e6079a91: "mm: postpone page table allocation until we have page to map" from Jun 9, 2016, leads to the following static checker warning:

	mm/memory.c:3175 do_fault_around()
	warn: if statement not indented

mm/memory.c

  3167          /* check if the page fault is solved */
  3168          fe->pte -= (fe->address >> PAGE_SHIFT) - (address >> PAGE_SHIFT);
  3169          if (!pte_none(*fe->pte)) {
  3170                  /*
  3171                   * Faultaround produce old pte, but the pte we've
  3172                   * handler fault for should be young.
  3173                   */
Quoted 5 lines

3174 pte_t entry = pte_mkyoung(*fe->pte);
3175 if (ptep_set_access_flags(fe->vma, fe->address, fe->pte,
3176 entry, 0))

What's going on here? Should the next line be indented?

Yes, it should. The checker is right, I screwed it on conflict solving. Thanks for spotting this.

Fixup is below.

Quoted 9 lines
  3177                  update_mmu_cache(fe->vma, fe->address, fe->pte);
  3178                  ret = VM_FAULT_NOPAGE;
  3179          }
  3180          pte_unmap_unlock(fe->pte, fe->ptl);
  3181  out:
  3182          fe->address = address;
  3183          fe->pte = NULL;
  3184          return ret;
  3185  }
mm/memory.c +1 -1
index 8e80e8ffc6ee..02cd5d9f0571 100644
@@ -3174,7 +3174,7 @@ static int do_fault_around(struct fault_env *fe, pgoff_t start_pgoff)
 		pte_t entry = pte_mkyoung(*fe->pte);
 		if (ptep_set_access_flags(fe->vma, fe->address, fe->pte,
 					entry, 0))
-		update_mmu_cache(fe->vma, fe->address, fe->pte);
+			update_mmu_cache(fe->vma, fe->address, fe->pte);
 		ret = VM_FAULT_NOPAGE;
 	}
 	pte_unmap_unlock(fe->pte, fe->ptl);
Signature · 7 lines
 Kirill A. Shutemov

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to [email protected].  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>