Commit 7894c263 authored by Arnd Bergmann's avatar Arnd Bergmann Committed by Greg Kroah-Hartman

staging: lustre: fix unstable pages tracking

A patch to change to page accounting code (in v4.8-rc1) conflicts with
a change to lustre (in staging-next for v4.9), and fortunately gets
detected using a gcc warning:

In file included from /git/arm-soc/include/linux/mm.h:1001:0,
                 from /git/arm-soc/include/linux/highmem.h:7,
                 from /git/arm-soc/drivers/staging/lustre/lustre/osc/../../include/linux/libcfs/linux/libcfs.h:46,
                 from /git/arm-soc/drivers/staging/lustre/lustre/osc/../../include/linux/libcfs/libcfs.h:36,
                 from /git/arm-soc/drivers/staging/lustre/lustre/osc/osc_cl_internal.h:45,
                 from /git/arm-soc/drivers/staging/lustre/lustre/osc/osc_page.c:40:
drivers/staging/lustre/lustre/osc/osc_page.c: In function 'unstable_page_accounting':
include/linux/vmstat.h:117:2: error: array subscript is above array bounds [-Werror=array-bounds]
  atomic_long_add(x, &vm_zone_stat[item]);
  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/vmstat.h:117:2: error: array subscript is above array bounds [-Werror=array-bounds]
  atomic_long_add(x, &vm_zone_stat[item]);
  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

This changes the function to use the correct interface for accounting in the
"node" rather than the "zone".
Signed-off-by: default avatarArnd Bergmann <arnd@arndb.de>
Fixes: d806f30e ("staging: lustre: osc: revise unstable pages accounting")
Fixes: 11fb9989 ("mm: move most file-based accounting to the node")
Reviewed-by: default avatarJames Simmons <jsimmons@infradead.org>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent bbc2d82f
...@@ -789,7 +789,7 @@ static int osc_lru_reserve(const struct lu_env *env, struct osc_object *obj, ...@@ -789,7 +789,7 @@ static int osc_lru_reserve(const struct lu_env *env, struct osc_object *obj,
/** /**
* Atomic operations are expensive. We accumulate the accounting for the * Atomic operations are expensive. We accumulate the accounting for the
* same page zone to get better performance. * same page pgdat to get better performance.
* In practice this can work pretty good because the pages in the same RPC * In practice this can work pretty good because the pages in the same RPC
* are likely from the same page zone. * are likely from the same page zone.
*/ */
...@@ -797,28 +797,28 @@ static inline void unstable_page_accounting(struct ptlrpc_bulk_desc *desc, ...@@ -797,28 +797,28 @@ static inline void unstable_page_accounting(struct ptlrpc_bulk_desc *desc,
int factor) int factor)
{ {
int page_count = desc->bd_iov_count; int page_count = desc->bd_iov_count;
void *zone = NULL; pg_data_t *last = NULL;
int count = 0; int count = 0;
int i; int i;
for (i = 0; i < page_count; i++) { for (i = 0; i < page_count; i++) {
void *pz = page_zone(desc->bd_iov[i].bv_page); pg_data_t *pgdat = page_pgdat(desc->bd_iov[i].bv_page);
if (likely(pz == zone)) { if (likely(pgdat == last)) {
++count; ++count;
continue; continue;
} }
if (count > 0) { if (count > 0) {
mod_zone_page_state(zone, NR_UNSTABLE_NFS, mod_node_page_state(pgdat, NR_UNSTABLE_NFS,
factor * count); factor * count);
count = 0; count = 0;
} }
zone = pz; last = pgdat;
++count; ++count;
} }
if (count > 0) if (count > 0)
mod_zone_page_state(zone, NR_UNSTABLE_NFS, factor * count); mod_node_page_state(last, NR_UNSTABLE_NFS, factor * count);
} }
static inline void add_unstable_page_accounting(struct ptlrpc_bulk_desc *desc) static inline void add_unstable_page_accounting(struct ptlrpc_bulk_desc *desc)
......
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