Skip to contentSkip to conversation

mm: Count the number of pages affected in change_protection()

tip:numa/core Andrew Morton 1 participant 1 message Nov 14, 2012 1 message not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw
Quoted 4 lines · On Wed, 14 Nov 2012 06:25:56 -0800 tip-bot for Peter Zijlstra…

mm: Count the number of pages affected in change_protection()

This will be used by three kinds of purposes:

Quoted 8 lines

- to optimize mprotect()

- to speed up working set scanning for working set areas that have not been touched

- to more accurately scan per real working set

No change in functionality from this patch.

Seems simple, cheap and useful.

A bit lacking in interface comments though. In particular, does the return value (which is in units of PAGE_SIZE pages) represent the number of pages which were inspected, or the number of pages which actually had their permissions modified?

Quoted 1 line

From a quick look, it seems the answer is both. Or neither. If a

page's protection was written to but unaltered, that counts as a "1". But if a pmd couldn't be locked via __pmd_trans_huge_lock(), that counts as a "0".

Anyway, please have a think about it, and describe exactly what these return values mean?