Commit cd7fae26 authored by Miaohe Lin's avatar Miaohe Lin Committed by Linus Torvalds

ksm: remove dedicated macro KSM_FLAG_MASK

The macro KSM_FLAG_MASK is used in rmap_walk_ksm() only.  So we can
replace ~KSM_FLAG_MASK with PAGE_MASK to remove this dedicated macro and
make code more consistent because PAGE_MASK is used elsewhere in this
file.

Link: https://lkml.kernel.org/r/20210330140228.45635-4-linmiaohe@huawei.comSigned-off-by: default avatarMiaohe Lin <linmiaohe@huawei.com>
Cc: Hugh Dickins <hughd@google.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 3e96b6a2
...@@ -215,8 +215,6 @@ struct rmap_item { ...@@ -215,8 +215,6 @@ struct rmap_item {
#define SEQNR_MASK 0x0ff /* low bits of unstable tree seqnr */ #define SEQNR_MASK 0x0ff /* low bits of unstable tree seqnr */
#define UNSTABLE_FLAG 0x100 /* is a node of the unstable tree */ #define UNSTABLE_FLAG 0x100 /* is a node of the unstable tree */
#define STABLE_FLAG 0x200 /* is listed from the stable tree */ #define STABLE_FLAG 0x200 /* is listed from the stable tree */
#define KSM_FLAG_MASK (SEQNR_MASK|UNSTABLE_FLAG|STABLE_FLAG)
/* to mask all the flags */
/* The stable and unstable tree heads */ /* The stable and unstable tree heads */
static struct rb_root one_stable_tree[1] = { RB_ROOT }; static struct rb_root one_stable_tree[1] = { RB_ROOT };
...@@ -2631,7 +2629,7 @@ void rmap_walk_ksm(struct page *page, struct rmap_walk_control *rwc) ...@@ -2631,7 +2629,7 @@ void rmap_walk_ksm(struct page *page, struct rmap_walk_control *rwc)
vma = vmac->vma; vma = vmac->vma;
/* Ignore the stable/unstable/sqnr flags */ /* Ignore the stable/unstable/sqnr flags */
addr = rmap_item->address & ~KSM_FLAG_MASK; addr = rmap_item->address & PAGE_MASK;
if (addr < vma->vm_start || addr >= vma->vm_end) if (addr < vma->vm_start || addr >= vma->vm_end)
continue; continue;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment