[PATCH] TESTING: understand clflushopt() compilation error

From: Ross Zwisler
Date: Mon Oct 19 2015 - 13:59:02 EST


---
drivers/nvdimm/pmem.c | 14 ++++++++++++++
1 file changed, 14 insertions(+)

diff --git a/drivers/nvdimm/pmem.c b/drivers/nvdimm/pmem.c
index 0ba6a97..3f735a6 100644
--- a/drivers/nvdimm/pmem.c
+++ b/drivers/nvdimm/pmem.c
@@ -451,6 +451,20 @@ static int __init pmem_init(void)
{
int error;

+ unsigned long clflush_size = boot_cpu_data.x86_clflush_size;
+ const unsigned int size = PAGE_SIZE;
+ void *addr = kmalloc(size, GFP_KERNEL);
+ void *end = addr + size;
+ void *p;
+
+ mb();
+ for (p = (void *)((unsigned long)addr & -clflush_size); p < end;
+ p += clflush_size)
+ clflush(p);
+ mb();
+
+ kfree(addr);
+
pmem_major = register_blkdev(0, "pmem");
if (pmem_major < 0)
return pmem_major;
--
2.1.0

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/