aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDave Jiang <dave.jiang@intel.com>2016-09-26 14:06:50 -0400
committerDan Williams <dan.j.williams@intel.com>2016-09-30 22:12:52 -0400
commitdb58028ee4e360430de8e3b48f657dc798ee6591 (patch)
tree1f59b23cb217117e18c557b3705e7a66976cbe1e
parent595c73071e6641e59b83911fbb4026e767471000 (diff)
nvdimm: reduce duplicated wpq flushes
Existing implemenetation writes to all the flush hint addresses for a given ND region. This is not necessary as the flushes are per imc and not per DIMM. Search the mappings and clear out the duplicates at init to avoid multiple flush to the same imc. Signed-off-by: Dave Jiang <dave.jiang@intel.com> Signed-off-by: Dan Williams <dan.j.williams@intel.com>
-rw-r--r--drivers/nvdimm/region_devs.c17
1 files changed, 16 insertions, 1 deletions
diff --git a/drivers/nvdimm/region_devs.c b/drivers/nvdimm/region_devs.c
index 4c0ac4abb629..f9d58c2b5341 100644
--- a/drivers/nvdimm/region_devs.c
+++ b/drivers/nvdimm/region_devs.c
@@ -70,7 +70,7 @@ static int nvdimm_map_flush(struct device *dev, struct nvdimm *nvdimm, int dimm,
70 70
71int nd_region_activate(struct nd_region *nd_region) 71int nd_region_activate(struct nd_region *nd_region)
72{ 72{
73 int i, num_flush = 0; 73 int i, j, num_flush = 0;
74 struct nd_region_data *ndrd; 74 struct nd_region_data *ndrd;
75 struct device *dev = &nd_region->dev; 75 struct device *dev = &nd_region->dev;
76 size_t flush_data_size = sizeof(void *); 76 size_t flush_data_size = sizeof(void *);
@@ -107,6 +107,21 @@ int nd_region_activate(struct nd_region *nd_region)
107 return rc; 107 return rc;
108 } 108 }
109 109
110 /*
111 * Clear out entries that are duplicates. This should prevent the
112 * extra flushings.
113 */
114 for (i = 0; i < nd_region->ndr_mappings - 1; i++) {
115 /* ignore if NULL already */
116 if (!ndrd_get_flush_wpq(ndrd, i, 0))
117 continue;
118
119 for (j = i + 1; j < nd_region->ndr_mappings; j++)
120 if (ndrd_get_flush_wpq(ndrd, i, 0) ==
121 ndrd_get_flush_wpq(ndrd, j, 0))
122 ndrd_set_flush_wpq(ndrd, j, 0, NULL);
123 }
124
110 return 0; 125 return 0;
111} 126}
112 127