Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1321930
| From | Johannes Weiner <hannes@cmpxchg.org> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | [PATCH v2 2/5] mm: workingset: #define radix entry eviction mask |
| Date | 2016-01-29 19:00 +0100 |
| Message-ID | <qWluW-6FF-15@gated-at.bofh.it> (permalink) |
| References | <qWluW-6FF-9@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
This is a compile-time constant, no need to calculate it on refault.
Signed-off-by: Johannes Weiner <hannes@cmpxchg.org>
Reviewed-by: Vladimir Davydov <vdavydov@virtuozzo.com>
---
mm/workingset.c | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/mm/workingset.c b/mm/workingset.c
index 61ead9e..3ef92f6 100644
--- a/mm/workingset.c
+++ b/mm/workingset.c
@@ -152,6 +152,10 @@
* refault distance will immediately activate the refaulting page.
*/
+#define EVICTION_SHIFT (RADIX_TREE_EXCEPTIONAL_ENTRY + \
+ ZONES_SHIFT + NODES_SHIFT)
+#define EVICTION_MASK (~0UL >> EVICTION_SHIFT)
+
static void *pack_shadow(unsigned long eviction, struct zone *zone)
{
eviction = (eviction << NODES_SHIFT) | zone_to_nid(zone);
@@ -168,7 +172,6 @@ static void unpack_shadow(void *shadow,
unsigned long entry = (unsigned long)shadow;
unsigned long eviction;
unsigned long refault;
- unsigned long mask;
int zid, nid;
entry >>= RADIX_TREE_EXCEPTIONAL_SHIFT;
@@ -181,8 +184,7 @@ static void unpack_shadow(void *shadow,
*zone = NODE_DATA(nid)->node_zones + zid;
refault = atomic_long_read(&(*zone)->inactive_age);
- mask = ~0UL >> (NODES_SHIFT + ZONES_SHIFT +
- RADIX_TREE_EXCEPTIONAL_SHIFT);
+
/*
* The unsigned subtraction here gives an accurate distance
* across inactive_age overflows in most cases.
@@ -199,7 +201,7 @@ static void unpack_shadow(void *shadow,
* inappropriate activation leading to pressure on the active
* list is not a problem.
*/
- *distance = (refault - eviction) & mask;
+ *distance = (refault - eviction) & EVICTION_MASK;
}
/**
--
2.7.0
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH v2 0/5] mm: workingset: per-cgroup thrash detection Johannes Weiner <hannes@cmpxchg.org> - 2016-01-29 19:00 +0100
[PATCH v2 1/5] mm: memcontrol: generalize locking for the page->mem_cgroup binding Johannes Weiner <hannes@cmpxchg.org> - 2016-01-29 19:00 +0100
Re: [PATCH v2 1/5] mm: memcontrol: generalize locking for the page->mem_cgroup binding Vladimir Davydov <vdavydov@virtuozzo.com> - 2016-02-02 15:20 +0100
[PATCH v2 2/5] mm: workingset: #define radix entry eviction mask Johannes Weiner <hannes@cmpxchg.org> - 2016-01-29 19:00 +0100
[PATCH v2 5/5] mm: workingset: per-cgroup cache thrash detection Johannes Weiner <hannes@cmpxchg.org> - 2016-01-29 19:00 +0100
Re: [PATCH v2 5/5] mm: workingset: per-cgroup cache thrash detection Vladimir Davydov <vdavydov@virtuozzo.com> - 2016-02-02 15:40 +0100
[PATCH v2 3/5] mm: workingset: separate shadow unpacking and refault calculation Johannes Weiner <hannes@cmpxchg.org> - 2016-01-29 19:00 +0100
csiph-web