提交 64363aad 编写于 作者: J Joe Perches 提交者: Linus Torvalds

mm: remove unused VM_<READfoo> macros and expand other in-place

These VM_<READfoo> macros aren't used very often and three of them
aren't used at all.

Expand the ones that are used in-place, and remove all the now unused
#define VM_<foo> macros.

VM_READHINTMASK, VM_NormalReadHint and VM_ClearReadHint were added just
before 2.4 and appears have never been used.
Signed-off-by: NJoe Perches <joe@perches.com>
Acked-by: NKOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
上级 73b44ff4
...@@ -151,12 +151,6 @@ extern unsigned int kobjsize(const void *objp); ...@@ -151,12 +151,6 @@ extern unsigned int kobjsize(const void *objp);
#define VM_STACK_FLAGS (VM_GROWSDOWN | VM_STACK_DEFAULT_FLAGS | VM_ACCOUNT) #define VM_STACK_FLAGS (VM_GROWSDOWN | VM_STACK_DEFAULT_FLAGS | VM_ACCOUNT)
#endif #endif
#define VM_READHINTMASK (VM_SEQ_READ | VM_RAND_READ)
#define VM_ClearReadHint(v) (v)->vm_flags &= ~VM_READHINTMASK
#define VM_NormalReadHint(v) (!((v)->vm_flags & VM_READHINTMASK))
#define VM_SequentialReadHint(v) ((v)->vm_flags & VM_SEQ_READ)
#define VM_RandomReadHint(v) ((v)->vm_flags & VM_RAND_READ)
/* /*
* Special vmas that are non-mergable, non-mlock()able. * Special vmas that are non-mergable, non-mlock()able.
* Note: mm/huge_memory.c VM_NO_THP depends on this definition. * Note: mm/huge_memory.c VM_NO_THP depends on this definition.
......
...@@ -1539,12 +1539,12 @@ static void do_sync_mmap_readahead(struct vm_area_struct *vma, ...@@ -1539,12 +1539,12 @@ static void do_sync_mmap_readahead(struct vm_area_struct *vma,
struct address_space *mapping = file->f_mapping; struct address_space *mapping = file->f_mapping;
/* If we don't want any read-ahead, don't bother */ /* If we don't want any read-ahead, don't bother */
if (VM_RandomReadHint(vma)) if (vma->vm_flags & VM_RAND_READ)
return; return;
if (!ra->ra_pages) if (!ra->ra_pages)
return; return;
if (VM_SequentialReadHint(vma)) { if (vma->vm_flags & VM_SEQ_READ) {
page_cache_sync_readahead(mapping, ra, file, offset, page_cache_sync_readahead(mapping, ra, file, offset,
ra->ra_pages); ra->ra_pages);
return; return;
...@@ -1584,7 +1584,7 @@ static void do_async_mmap_readahead(struct vm_area_struct *vma, ...@@ -1584,7 +1584,7 @@ static void do_async_mmap_readahead(struct vm_area_struct *vma,
struct address_space *mapping = file->f_mapping; struct address_space *mapping = file->f_mapping;
/* If we don't want any read-ahead, don't bother */ /* If we don't want any read-ahead, don't bother */
if (VM_RandomReadHint(vma)) if (vma->vm_flags & VM_RAND_READ)
return; return;
if (ra->mmap_miss > 0) if (ra->mmap_miss > 0)
ra->mmap_miss--; ra->mmap_miss--;
......
...@@ -1150,7 +1150,7 @@ static unsigned long zap_pte_range(struct mmu_gather *tlb, ...@@ -1150,7 +1150,7 @@ static unsigned long zap_pte_range(struct mmu_gather *tlb,
if (pte_dirty(ptent)) if (pte_dirty(ptent))
set_page_dirty(page); set_page_dirty(page);
if (pte_young(ptent) && if (pte_young(ptent) &&
likely(!VM_SequentialReadHint(vma))) likely(!(vma->vm_flags & VM_SEQ_READ)))
mark_page_accessed(page); mark_page_accessed(page);
rss[MM_FILEPAGES]--; rss[MM_FILEPAGES]--;
} }
......
...@@ -720,7 +720,7 @@ int page_referenced_one(struct page *page, struct vm_area_struct *vma, ...@@ -720,7 +720,7 @@ int page_referenced_one(struct page *page, struct vm_area_struct *vma,
* mapping is already gone, the unmap path will have * mapping is already gone, the unmap path will have
* set PG_referenced or activated the page. * set PG_referenced or activated the page.
*/ */
if (likely(!VM_SequentialReadHint(vma))) if (likely(!(vma->vm_flags & VM_SEQ_READ)))
referenced++; referenced++;
} }
pte_unmap_unlock(pte, ptl); pte_unmap_unlock(pte, ptl);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册