top: add tie breaking for topmem mode
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
This commit is contained in:
parent
6af732b9ae
commit
a95ce93e57
@ -686,10 +686,10 @@ static int topmem_sort(char *a, char *b)
|
|||||||
n = offsetof(topmem_status_t, vsz) + (sort_field * sizeof(mem_t));
|
n = offsetof(topmem_status_t, vsz) + (sort_field * sizeof(mem_t));
|
||||||
l = *(mem_t*)(a + n);
|
l = *(mem_t*)(a + n);
|
||||||
r = *(mem_t*)(b + n);
|
r = *(mem_t*)(b + n);
|
||||||
// if (l == r) {
|
if (l == r) {
|
||||||
// l = a->mapped_rw;
|
l = ((topmem_status_t*)a)->dirty;
|
||||||
// r = b->mapped_rw;
|
r = ((topmem_status_t*)b)->dirty;
|
||||||
// }
|
}
|
||||||
/* We want to avoid unsigned->signed and truncation errors */
|
/* We want to avoid unsigned->signed and truncation errors */
|
||||||
/* l>r: -1, l=r: 0, l<r: 1 */
|
/* l>r: -1, l=r: 0, l<r: 1 */
|
||||||
n = (l > r) ? -1 : (l != r);
|
n = (l > r) ? -1 : (l != r);
|
||||||
|
Loading…
Reference in New Issue
Block a user