Skip to content

Commit

Permalink
mm: add comment on storage key dirty bit semantics
Browse files Browse the repository at this point in the history
Add comments that dirty bit in storage key gets set whenever page content
is changed.  Hopefully if someone will use this function, he'll have a
look at one of the two places where we comment on this.

Signed-off-by: Jan Kara <[email protected]>
Cc: Martin Schwidefsky <[email protected]>
Cc: Mel Gorman <[email protected]>
Cc: Hugh Dickins <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
jankara authored and torvalds committed Dec 12, 2012
1 parent 712cd38 commit e749eb9
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
3 changes: 3 additions & 0 deletions arch/s390/include/asm/page.h
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,9 @@ static inline int page_reset_referenced(unsigned long addr)
* race against modification of the referenced bit. This function
* should therefore only be called if it is not mapped in any
* address space.
*
* Note that the bit gets set whenever page content is changed. That means
* also when the page is modified by DMA or from inside the kernel.
*/
#define __HAVE_ARCH_PAGE_TEST_AND_CLEAR_DIRTY
static inline int page_test_and_clear_dirty(unsigned long pfn, int mapped)
Expand Down
8 changes: 5 additions & 3 deletions mm/rmap.c
Original file line number Diff line number Diff line change
Expand Up @@ -1151,9 +1151,11 @@ void page_remove_rmap(struct page *page)
* containing the swap entry, but page not yet written to swap.
*
* And we can skip it on file pages, so long as the filesystem
* participates in dirty tracking; but need to catch shm and tmpfs
* and ramfs pages which have been modified since creation by read
* fault.
* participates in dirty tracking (note that this is not only an
* optimization but also solves problems caused by dirty flag in
* storage key getting set by a write from inside kernel); but need to
* catch shm and tmpfs and ramfs pages which have been modified since
* creation by read fault.
*
* Note that mapping must be decided above, before decrementing
* mapcount (which luckily provides a barrier): once page is unmapped,
Expand Down

0 comments on commit e749eb9

Please sign in to comment.