linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/6] cleanup libcfs memory handling
@ 2016-03-31 14:18 James Simmons
  2016-03-31 14:18 ` [PATCH 1/6] staging: lustre: libcfs: move add_wait_queue_exclusive_head to lustre layer James Simmons
                   ` (5 more replies)
  0 siblings, 6 replies; 9+ messages in thread
From: James Simmons @ 2016-03-31 14:18 UTC (permalink / raw)
  To: Greg Kroah-Hartman, devel, Andreas Dilger, Oleg Drokin
  Cc: Linux Kernel Mailing List, Lustre Development List, James Simmons

The libcfs module contains memory handling which needs to be
cleaned up. First cleanup is to merge linux-mem.h and libcfs_prim.h.
This is left over for when libcfs was both a kernel module
and a userspace library. Second cleanup is remove some wrappers
that are not needed. Just use kernel API's directly instead.
One last change is the move of add_wait_queue_exclusive_head
to the lustre layer since that is the only place it is used.
With these changes linux-mem.h can be deleted.

James Simmons (6):
  staging: lustre: libcfs: move add_wait_queue_exclusive_head to lustre layer
  staging: lustre: libcfs: move memory_pressure functions to libcfs_prim.h
  staging: lustre: libcfs: remove page_index() macro
  staging: lustre: libcfs: remove MMSPACE macros
  staging: lustre: libcfs: move NUM_CACHEPAGES to libcfs_prim.h
  staging: lustre: libcfs: delete linux-mem.h

 .../lustre/include/linux/libcfs/libcfs_prim.h      |   31 +++++---
 .../lustre/include/linux/libcfs/linux/libcfs.h     |    2 +-
 .../lustre/include/linux/libcfs/linux/linux-cpu.h  |    2 +-
 .../lustre/include/linux/libcfs/linux/linux-mem.h  |   79 --------------------
 .../staging/lustre/lnet/libcfs/linux/linux-prim.c  |   24 ------
 drivers/staging/lustre/lnet/libcfs/tracefile.c     |   17 ++--
 drivers/staging/lustre/lustre/include/lustre_lib.h |   22 ++++++
 drivers/staging/lustre/lustre/llite/vvp_page.c     |    2 +-
 drivers/staging/lustre/lustre/osc/osc_request.c    |    2 +-
 9 files changed, 55 insertions(+), 126 deletions(-)
 delete mode 100644 drivers/staging/lustre/include/linux/libcfs/linux/linux-mem.h

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH 1/6] staging: lustre: libcfs: move add_wait_queue_exclusive_head to lustre layer
  2016-03-31 14:18 [PATCH 0/6] cleanup libcfs memory handling James Simmons
@ 2016-03-31 14:18 ` James Simmons
  2016-03-31 14:18 ` [PATCH 2/6] staging: lustre: libcfs: move memory_pressure functions to libcfs_prim.h James Simmons
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 9+ messages in thread
From: James Simmons @ 2016-03-31 14:18 UTC (permalink / raw)
  To: Greg Kroah-Hartman, devel, Andreas Dilger, Oleg Drokin
  Cc: Linux Kernel Mailing List, Lustre Development List,
	James Simmons, James Simmons

Only lustre client uses add_wait_queue_exclusive_head() so move
it from libcfs layer to lustre_lib.h where it is needed.

Signed-off-by: James Simmons <uja.ornl@gmail.com>
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-6245
Reviewed-on: http://review.whamcloud.com/13874
Reviewed-by: Dmitry Eremin <dmitry.eremin@intel.com>
Reviewed-by: John L. Hammond <john.hammond@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
---
 .../lustre/include/linux/libcfs/libcfs_prim.h      |    2 -
 .../staging/lustre/lnet/libcfs/linux/linux-prim.c  |   24 --------------------
 drivers/staging/lustre/lustre/include/lustre_lib.h |   22 ++++++++++++++++++
 3 files changed, 22 insertions(+), 26 deletions(-)

diff --git a/drivers/staging/lustre/include/linux/libcfs/libcfs_prim.h b/drivers/staging/lustre/include/linux/libcfs/libcfs_prim.h
index 082fe6d..d7846e8 100644
--- a/drivers/staging/lustre/include/linux/libcfs/libcfs_prim.h
+++ b/drivers/staging/lustre/include/linux/libcfs/libcfs_prim.h
@@ -40,8 +40,6 @@
 #ifndef __LIBCFS_PRIM_H__
 #define __LIBCFS_PRIM_H__
 
-void add_wait_queue_exclusive_head(wait_queue_head_t *, wait_queue_t *);
-
 /*
  * Memory
  */
diff --git a/drivers/staging/lustre/lnet/libcfs/linux/linux-prim.c b/drivers/staging/lustre/lnet/libcfs/linux/linux-prim.c
index 7e5ef0a..bbe19a6 100644
--- a/drivers/staging/lustre/lnet/libcfs/linux/linux-prim.c
+++ b/drivers/staging/lustre/lnet/libcfs/linux/linux-prim.c
@@ -46,30 +46,6 @@
 #include <linux/kgdb.h>
 #endif
 
-/**
- * wait_queue_t of Linux (version < 2.6.34) is a FIFO list for exclusively
- * waiting threads, which is not always desirable because all threads will
- * be waken up again and again, even user only needs a few of them to be
- * active most time. This is not good for performance because cache can
- * be polluted by different threads.
- *
- * LIFO list can resolve this problem because we always wakeup the most
- * recent active thread by default.
- *
- * NB: please don't call non-exclusive & exclusive wait on the same
- * waitq if add_wait_queue_exclusive_head is used.
- */
-void
-add_wait_queue_exclusive_head(wait_queue_head_t *waitq, wait_queue_t *link)
-{
-	unsigned long flags;
-
-	spin_lock_irqsave(&waitq->lock, flags);
-	__add_wait_queue_exclusive(waitq, link);
-	spin_unlock_irqrestore(&waitq->lock, flags);
-}
-EXPORT_SYMBOL(add_wait_queue_exclusive_head);
-
 sigset_t
 cfs_block_allsigs(void)
 {
diff --git a/drivers/staging/lustre/lustre/include/lustre_lib.h b/drivers/staging/lustre/lustre/include/lustre_lib.h
index 2e66b27..00b9767 100644
--- a/drivers/staging/lustre/lustre/include/lustre_lib.h
+++ b/drivers/staging/lustre/lustre/include/lustre_lib.h
@@ -522,6 +522,28 @@ struct l_wait_info {
 			   sigmask(SIGTERM) | sigmask(SIGQUIT) |	\
 			   sigmask(SIGALRM))
 
+/**
+ * wait_queue_t of Linux (version < 2.6.34) is a FIFO list for exclusively
+ * waiting threads, which is not always desirable because all threads will
+ * be waken up again and again, even user only needs a few of them to be
+ * active most time. This is not good for performance because cache can
+ * be polluted by different threads.
+ *
+ * LIFO list can resolve this problem because we always wakeup the most
+ * recent active thread by default.
+ *
+ * NB: please don't call non-exclusive & exclusive wait on the same
+ * waitq if add_wait_queue_exclusive_head is used.
+ */
+#define add_wait_queue_exclusive_head(waitq, link)		\
+{								\
+	unsigned long flags;					\
+								\
+	spin_lock_irqsave(&((waitq)->lock), flags);		\
+	__add_wait_queue_exclusive(waitq, link);		\
+	spin_unlock_irqrestore(&((waitq)->lock), flags);	\
+}
+
 /*
  * wait for @condition to become true, but no longer than timeout, specified
  * by @info.
-- 
1.7.1

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH 2/6] staging: lustre: libcfs: move memory_pressure functions to libcfs_prim.h
  2016-03-31 14:18 [PATCH 0/6] cleanup libcfs memory handling James Simmons
  2016-03-31 14:18 ` [PATCH 1/6] staging: lustre: libcfs: move add_wait_queue_exclusive_head to lustre layer James Simmons
@ 2016-03-31 14:18 ` James Simmons
  2016-03-31 20:03   ` Greg Kroah-Hartman
  2016-03-31 14:18 ` [PATCH 3/6] staging: lustre: libcfs: remove page_index() macro James Simmons
                   ` (3 subsequent siblings)
  5 siblings, 1 reply; 9+ messages in thread
From: James Simmons @ 2016-03-31 14:18 UTC (permalink / raw)
  To: Greg Kroah-Hartman, devel, Andreas Dilger, Oleg Drokin
  Cc: Linux Kernel Mailing List, Lustre Development List,
	James Simmons, James Simmons

Long ago libcfs_prim.h was used for userland code which is why
memory_pressure_*() handling is in both libcfs_prim.h and
linux-mem.h headers. So lets just move the memory_pressure_*()
to libcfs_prim.h.

Signed-off-by: James Simmons <uja.ornl@gmail.com>
ntel-bug-id: https://jira.hpdd.intel.com/browse/LU-6245
Reviewed-on: http://review.whamcloud.com/13841
Reviewed-by: frank zago <fzago@cray.com>
Reviewed-by: Dmitry Eremin <dmitry.eremin@intel.com>
Reviewed-by: John L. Hammond <john.hammond@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
---
 .../lustre/include/linux/libcfs/libcfs_prim.h      |   23 ++++++++++++-------
 .../lustre/include/linux/libcfs/linux/linux-mem.h  |    4 ---
 2 files changed, 14 insertions(+), 13 deletions(-)

diff --git a/drivers/staging/lustre/include/linux/libcfs/libcfs_prim.h b/drivers/staging/lustre/include/linux/libcfs/libcfs_prim.h
index d7846e8..d97060b 100644
--- a/drivers/staging/lustre/include/linux/libcfs/libcfs_prim.h
+++ b/drivers/staging/lustre/include/linux/libcfs/libcfs_prim.h
@@ -43,15 +43,20 @@
 /*
  * Memory
  */
-#ifndef memory_pressure_get
-#define memory_pressure_get() (0)
-#endif
-#ifndef memory_pressure_set
-#define memory_pressure_set() do {} while (0)
-#endif
-#ifndef memory_pressure_clr
-#define memory_pressure_clr() do {} while (0)
-#endif
+static inline unsigned int memory_pressure_get(void)
+{
+	return current->flags & PF_MEMALLOC;
+}
+
+static inline void memory_pressure_set(void)
+{
+	current->flags |= PF_MEMALLOC;
+}
+
+static inline void memory_pressure_clr(void)
+{
+	current->flags &= ~PF_MEMALLOC;
+}
 
 static inline int cfs_memory_pressure_get_and_set(void)
 {
diff --git a/drivers/staging/lustre/include/linux/libcfs/linux/linux-mem.h b/drivers/staging/lustre/include/linux/libcfs/linux/linux-mem.h
index 448379b..c50ef83 100644
--- a/drivers/staging/lustre/include/linux/libcfs/linux/linux-mem.h
+++ b/drivers/staging/lustre/include/linux/libcfs/linux/linux-mem.h
@@ -59,10 +59,6 @@
 
 #define page_index(p)       ((p)->index)
 
-#define memory_pressure_get() (current->flags & PF_MEMALLOC)
-#define memory_pressure_set() do { current->flags |= PF_MEMALLOC; } while (0)
-#define memory_pressure_clr() do { current->flags &= ~PF_MEMALLOC; } while (0)
-
 #if BITS_PER_LONG == 32
 /* limit to lowmem on 32-bit systems */
 #define NUM_CACHEPAGES \
-- 
1.7.1

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH 3/6] staging: lustre: libcfs: remove page_index() macro
  2016-03-31 14:18 [PATCH 0/6] cleanup libcfs memory handling James Simmons
  2016-03-31 14:18 ` [PATCH 1/6] staging: lustre: libcfs: move add_wait_queue_exclusive_head to lustre layer James Simmons
  2016-03-31 14:18 ` [PATCH 2/6] staging: lustre: libcfs: move memory_pressure functions to libcfs_prim.h James Simmons
@ 2016-03-31 14:18 ` James Simmons
  2016-03-31 14:18 ` [PATCH 4/6] staging: lustre: libcfs: remove MMSPACE macros James Simmons
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 9+ messages in thread
From: James Simmons @ 2016-03-31 14:18 UTC (permalink / raw)
  To: Greg Kroah-Hartman, devel, Andreas Dilger, Oleg Drokin
  Cc: Linux Kernel Mailing List, Lustre Development List,
	James Simmons, James Simmons

Just use the index field directly for struct page.

Signed-off-by: James Simmons <uja.ornl@gmail.com>
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-6245
Reviewed-on: http://review.whamcloud.com/13841
Reviewed-by: frank zago <fzago@cray.com>
Reviewed-by: Dmitry Eremin <dmitry.eremin@intel.com>
Reviewed-by: John L. Hammond <john.hammond@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
---
 .../lustre/include/linux/libcfs/linux/linux-mem.h  |    2 --
 drivers/staging/lustre/lustre/llite/vvp_page.c     |    2 +-
 drivers/staging/lustre/lustre/osc/osc_request.c    |    2 +-
 3 files changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/lustre/include/linux/libcfs/linux/linux-mem.h b/drivers/staging/lustre/include/linux/libcfs/linux/linux-mem.h
index c50ef83..12fde3c 100644
--- a/drivers/staging/lustre/include/linux/libcfs/linux/linux-mem.h
+++ b/drivers/staging/lustre/include/linux/libcfs/linux/linux-mem.h
@@ -57,8 +57,6 @@
 #include "../libcfs_cpu.h"
 #endif
 
-#define page_index(p)       ((p)->index)
-
 #if BITS_PER_LONG == 32
 /* limit to lowmem on 32-bit systems */
 #define NUM_CACHEPAGES \
diff --git a/drivers/staging/lustre/lustre/llite/vvp_page.c b/drivers/staging/lustre/lustre/llite/vvp_page.c
index 69316c1..0c92293 100644
--- a/drivers/staging/lustre/lustre/llite/vvp_page.c
+++ b/drivers/staging/lustre/lustre/llite/vvp_page.c
@@ -394,7 +394,7 @@ static int vvp_page_print(const struct lu_env *env,
 		(*printer)(env, cookie, "%lx %d:%d %lx %lu %slru",
 			   (long)vmpage->flags, page_count(vmpage),
 			   page_mapcount(vmpage), vmpage->private,
-			   page_index(vmpage),
+			   vmpage->index,
 			   list_empty(&vmpage->lru) ? "not-" : "");
 	}
 
diff --git a/drivers/staging/lustre/lustre/osc/osc_request.c b/drivers/staging/lustre/lustre/osc/osc_request.c
index 4d3eed6..547539c 100644
--- a/drivers/staging/lustre/lustre/osc/osc_request.c
+++ b/drivers/staging/lustre/lustre/osc/osc_request.c
@@ -1934,7 +1934,7 @@ int osc_build_rpc(const struct lu_env *env, struct client_obd *cli,
 		pga[i] = &oap->oap_brw_page;
 		pga[i]->off = oap->oap_obj_off + oap->oap_page_off;
 		CDEBUG(0, "put page %p index %lu oap %p flg %x to pga\n",
-		       pga[i]->pg, page_index(oap->oap_page), oap,
+		       pga[i]->pg, oap->oap_page->index, oap,
 		       pga[i]->flag);
 		i++;
 		cl_req_page_add(env, clerq, page);
-- 
1.7.1

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH 4/6] staging: lustre: libcfs: remove MMSPACE macros
  2016-03-31 14:18 [PATCH 0/6] cleanup libcfs memory handling James Simmons
                   ` (2 preceding siblings ...)
  2016-03-31 14:18 ` [PATCH 3/6] staging: lustre: libcfs: remove page_index() macro James Simmons
@ 2016-03-31 14:18 ` James Simmons
  2016-03-31 14:18 ` [PATCH 5/6] staging: lustre: libcfs: move NUM_CACHEPAGES to libcfs_prim.h James Simmons
  2016-03-31 14:18 ` [PATCH 6/6] staging: lustre: libcfs: delete linux-mem.h James Simmons
  5 siblings, 0 replies; 9+ messages in thread
From: James Simmons @ 2016-03-31 14:18 UTC (permalink / raw)
  To: Greg Kroah-Hartman, devel, Andreas Dilger, Oleg Drokin
  Cc: Linux Kernel Mailing List, Lustre Development List,
	James Simmons, James Simmons

Another abstraction that is not needed.

Signed-off-by: James Simmons <uja.ornl@gmail.com>
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-6245
Reviewed-on: http://review.whamcloud.com/13841
Reviewed-by: frank zago <fzago@cray.com>
Reviewed-by: Dmitry Eremin <dmitry.eremin@intel.com>
Reviewed-by: John L. Hammond <john.hammond@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
---
 .../lustre/include/linux/libcfs/linux/linux-mem.h  |    5 -----
 drivers/staging/lustre/lnet/libcfs/tracefile.c     |   17 ++++++++---------
 2 files changed, 8 insertions(+), 14 deletions(-)

diff --git a/drivers/staging/lustre/include/linux/libcfs/linux/linux-mem.h b/drivers/staging/lustre/include/linux/libcfs/linux/linux-mem.h
index 12fde3c..c4b4284 100644
--- a/drivers/staging/lustre/include/linux/libcfs/linux/linux-mem.h
+++ b/drivers/staging/lustre/include/linux/libcfs/linux/linux-mem.h
@@ -65,9 +65,4 @@
 #define NUM_CACHEPAGES totalram_pages
 #endif
 
-#define DECL_MMSPACE		mm_segment_t __oldfs
-#define MMSPACE_OPEN \
-	do { __oldfs = get_fs(); set_fs(get_ds()); } while (0)
-#define MMSPACE_CLOSE	       set_fs(__oldfs)
-
 #endif /* __LINUX_CFS_MEM_H__ */
diff --git a/drivers/staging/lustre/lnet/libcfs/tracefile.c b/drivers/staging/lustre/lnet/libcfs/tracefile.c
index ec3bc04..5169597 100644
--- a/drivers/staging/lustre/lnet/libcfs/tracefile.c
+++ b/drivers/staging/lustre/lnet/libcfs/tracefile.c
@@ -707,10 +707,9 @@ int cfs_tracefile_dump_all_pages(char *filename)
 	struct cfs_trace_page	*tage;
 	struct cfs_trace_page	*tmp;
 	char			*buf;
+	mm_segment_t __oldfs;
 	int rc;
 
-	DECL_MMSPACE;
-
 	cfs_tracefile_write_lock();
 
 	filp = filp_open(filename, O_CREAT | O_EXCL | O_WRONLY | O_LARGEFILE,
@@ -729,11 +728,12 @@ int cfs_tracefile_dump_all_pages(char *filename)
 		rc = 0;
 		goto close;
 	}
+	__oldfs = get_fs();
+	set_fs(get_ds());
 
 	/* ok, for now, just write the pages.  in the future we'll be building
 	 * iobufs with the pages and calling generic_direct_IO
 	 */
-	MMSPACE_OPEN;
 	list_for_each_entry_safe(tage, tmp, &pc.pc_pages, linkage) {
 		__LASSERT_TAGE_INVARIANT(tage);
 
@@ -752,7 +752,7 @@ int cfs_tracefile_dump_all_pages(char *filename)
 		list_del(&tage->linkage);
 		cfs_tage_free(tage);
 	}
-	MMSPACE_CLOSE;
+	set_fs(__oldfs);
 	rc = vfs_fsync(filp, 1);
 	if (rc)
 		pr_err("sync returns %d\n", rc);
@@ -986,13 +986,12 @@ static int tracefiled(void *arg)
 	struct tracefiled_ctl *tctl = arg;
 	struct cfs_trace_page *tage;
 	struct cfs_trace_page *tmp;
+	mm_segment_t __oldfs;
 	struct file *filp;
 	char *buf;
 	int last_loop = 0;
 	int rc;
 
-	DECL_MMSPACE;
-
 	/* we're started late enough that we pick up init's fs context */
 	/* this is so broken in uml?  what on earth is going on? */
 
@@ -1025,8 +1024,8 @@ static int tracefiled(void *arg)
 			__LASSERT(list_empty(&pc.pc_pages));
 			goto end_loop;
 		}
-
-		MMSPACE_OPEN;
+		__oldfs = get_fs();
+		set_fs(get_ds());
 
 		list_for_each_entry_safe(tage, tmp, &pc.pc_pages, linkage) {
 			static loff_t f_pos;
@@ -1051,7 +1050,7 @@ static int tracefiled(void *arg)
 				break;
 			}
 		}
-		MMSPACE_CLOSE;
+		set_fs(__oldfs);
 
 		filp_close(filp, NULL);
 		put_pages_on_daemon_list(&pc);
-- 
1.7.1

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH 5/6] staging: lustre: libcfs: move NUM_CACHEPAGES to libcfs_prim.h
  2016-03-31 14:18 [PATCH 0/6] cleanup libcfs memory handling James Simmons
                   ` (3 preceding siblings ...)
  2016-03-31 14:18 ` [PATCH 4/6] staging: lustre: libcfs: remove MMSPACE macros James Simmons
@ 2016-03-31 14:18 ` James Simmons
  2016-03-31 14:18 ` [PATCH 6/6] staging: lustre: libcfs: delete linux-mem.h James Simmons
  5 siblings, 0 replies; 9+ messages in thread
From: James Simmons @ 2016-03-31 14:18 UTC (permalink / raw)
  To: Greg Kroah-Hartman, devel, Andreas Dilger, Oleg Drokin
  Cc: Linux Kernel Mailing List, Lustre Development List,
	James Simmons, James Simmons

We don't really need linux specific headers anymore so move
NUM_CACHEPAGES macro to libcfs_prim.h.

Signed-off-by: James Simmons <uja.ornl@gmail.com>
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-6245
Reviewed-on: http://review.whamcloud.com/13841
Reviewed-by: frank zago <fzago@cray.com>
Reviewed-by: Dmitry Eremin <dmitry.eremin@intel.com>
Reviewed-by: John L. Hammond <john.hammond@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
---
 .../lustre/include/linux/libcfs/libcfs_prim.h      |    8 ++++++++
 .../lustre/include/linux/libcfs/linux/linux-mem.h  |    8 --------
 2 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/drivers/staging/lustre/include/linux/libcfs/libcfs_prim.h b/drivers/staging/lustre/include/linux/libcfs/libcfs_prim.h
index d97060b..6f7a276 100644
--- a/drivers/staging/lustre/include/linux/libcfs/libcfs_prim.h
+++ b/drivers/staging/lustre/include/linux/libcfs/libcfs_prim.h
@@ -43,6 +43,14 @@
 /*
  * Memory
  */
+#if BITS_PER_LONG == 32
+/* limit to lowmem on 32-bit systems */
+#define NUM_CACHEPAGES \
+	min(totalram_pages, 1UL << (30 - PAGE_CACHE_SHIFT) * 3 / 4)
+#else
+#define NUM_CACHEPAGES totalram_pages
+#endif
+
 static inline unsigned int memory_pressure_get(void)
 {
 	return current->flags & PF_MEMALLOC;
diff --git a/drivers/staging/lustre/include/linux/libcfs/linux/linux-mem.h b/drivers/staging/lustre/include/linux/libcfs/linux/linux-mem.h
index c4b4284..9285fef 100644
--- a/drivers/staging/lustre/include/linux/libcfs/linux/linux-mem.h
+++ b/drivers/staging/lustre/include/linux/libcfs/linux/linux-mem.h
@@ -57,12 +57,4 @@
 #include "../libcfs_cpu.h"
 #endif
 
-#if BITS_PER_LONG == 32
-/* limit to lowmem on 32-bit systems */
-#define NUM_CACHEPAGES \
-	min(totalram_pages, 1UL << (30 - PAGE_CACHE_SHIFT) * 3 / 4)
-#else
-#define NUM_CACHEPAGES totalram_pages
-#endif
-
 #endif /* __LINUX_CFS_MEM_H__ */
-- 
1.7.1

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH 6/6] staging: lustre: libcfs: delete linux-mem.h
  2016-03-31 14:18 [PATCH 0/6] cleanup libcfs memory handling James Simmons
                   ` (4 preceding siblings ...)
  2016-03-31 14:18 ` [PATCH 5/6] staging: lustre: libcfs: move NUM_CACHEPAGES to libcfs_prim.h James Simmons
@ 2016-03-31 14:18 ` James Simmons
  5 siblings, 0 replies; 9+ messages in thread
From: James Simmons @ 2016-03-31 14:18 UTC (permalink / raw)
  To: Greg Kroah-Hartman, devel, Andreas Dilger, Oleg Drokin
  Cc: Linux Kernel Mailing List, Lustre Development List,
	James Simmons, James Simmons

The header linux-mem.h is no longer needed.

Signed-off-by: James Simmons <uja.ornl@gmail.com>
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-6245
Reviewed-on: http://review.whamcloud.com/13841
Reviewed-by: frank zago <fzago@cray.com>
Reviewed-by: Dmitry Eremin <dmitry.eremin@intel.com>
Reviewed-by: John L. Hammond <john.hammond@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
---
 .../lustre/include/linux/libcfs/linux/libcfs.h     |    2 +-
 .../lustre/include/linux/libcfs/linux/linux-cpu.h  |    2 +-
 .../lustre/include/linux/libcfs/linux/linux-mem.h  |   60 --------------------
 3 files changed, 2 insertions(+), 62 deletions(-)
 delete mode 100644 drivers/staging/lustre/include/linux/libcfs/linux/linux-mem.h

diff --git a/drivers/staging/lustre/include/linux/libcfs/linux/libcfs.h b/drivers/staging/lustre/include/linux/libcfs/linux/libcfs.h
index d94b266..a268ef7 100644
--- a/drivers/staging/lustre/include/linux/libcfs/linux/libcfs.h
+++ b/drivers/staging/lustre/include/linux/libcfs/linux/libcfs.h
@@ -60,6 +60,7 @@
 #include <linux/moduleparam.h>
 #include <linux/mutex.h>
 #include <linux/notifier.h>
+#include <linux/pagemap.h>
 #include <linux/random.h>
 #include <linux/rbtree.h>
 #include <linux/rwsem.h>
@@ -83,7 +84,6 @@
 #include <stdarg.h>
 #include "linux-cpu.h"
 #include "linux-time.h"
-#include "linux-mem.h"
 
 #define LUSTRE_TRACE_SIZE (THREAD_SIZE >> 5)
 
diff --git a/drivers/staging/lustre/include/linux/libcfs/linux/linux-cpu.h b/drivers/staging/lustre/include/linux/libcfs/linux/linux-cpu.h
index c04979a..f63cb47 100644
--- a/drivers/staging/lustre/include/linux/libcfs/linux/linux-cpu.h
+++ b/drivers/staging/lustre/include/linux/libcfs/linux/linux-cpu.h
@@ -23,7 +23,7 @@
  * This file is part of Lustre, http://www.lustre.org/
  * Lustre is a trademark of Sun Microsystems, Inc.
  *
- * libcfs/include/libcfs/linux/linux-mem.h
+ * libcfs/include/libcfs/linux/linux-cpu.h
  *
  * Basic library routines.
  *
diff --git a/drivers/staging/lustre/include/linux/libcfs/linux/linux-mem.h b/drivers/staging/lustre/include/linux/libcfs/linux/linux-mem.h
deleted file mode 100644
index 9285fef..0000000
--- a/drivers/staging/lustre/include/linux/libcfs/linux/linux-mem.h
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * GPL HEADER START
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 only,
- * as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * General Public License version 2 for more details (a copy is included
- * in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU General Public License
- * version 2 along with this program; If not, see
- * http://www.sun.com/software/products/lustre/docs/GPLv2.pdf
- *
- * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
- * CA 95054 USA or visit www.sun.com if you need additional information or
- * have any questions.
- *
- * GPL HEADER END
- */
-/*
- * Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
- * Use is subject to license terms.
- *
- * Copyright (c) 2011, 2012, Intel Corporation.
- */
-/*
- * This file is part of Lustre, http://www.lustre.org/
- * Lustre is a trademark of Sun Microsystems, Inc.
- *
- * libcfs/include/libcfs/linux/linux-mem.h
- *
- * Basic library routines.
- */
-
-#ifndef __LIBCFS_LINUX_CFS_MEM_H__
-#define __LIBCFS_LINUX_CFS_MEM_H__
-
-#ifndef __LIBCFS_LIBCFS_H__
-#error Do not #include this file directly. #include <linux/libcfs/libcfs.h> instead
-#endif
-
-#include <linux/mm.h>
-#include <linux/vmalloc.h>
-#include <linux/pagemap.h>
-#include <linux/slab.h>
-#include <linux/memcontrol.h>
-#include <linux/mm_inline.h>
-
-#ifndef HAVE_LIBCFS_CPT
-/* Need this for cfs_cpt_table */
-#include "../libcfs_cpu.h"
-#endif
-
-#endif /* __LINUX_CFS_MEM_H__ */
-- 
1.7.1

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* Re: [PATCH 2/6] staging: lustre: libcfs: move memory_pressure functions to libcfs_prim.h
  2016-03-31 14:18 ` [PATCH 2/6] staging: lustre: libcfs: move memory_pressure functions to libcfs_prim.h James Simmons
@ 2016-03-31 20:03   ` Greg Kroah-Hartman
  2016-03-31 20:33     ` [lustre-devel] " Simmons, James A.
  0 siblings, 1 reply; 9+ messages in thread
From: Greg Kroah-Hartman @ 2016-03-31 20:03 UTC (permalink / raw)
  To: James Simmons
  Cc: devel, Andreas Dilger, Oleg Drokin, James Simmons,
	Linux Kernel Mailing List, Lustre Development List

On Thu, Mar 31, 2016 at 10:18:36AM -0400, James Simmons wrote:
> Long ago libcfs_prim.h was used for userland code which is why
> memory_pressure_*() handling is in both libcfs_prim.h and
> linux-mem.h headers. So lets just move the memory_pressure_*()
> to libcfs_prim.h.
> 
> Signed-off-by: James Simmons <uja.ornl@gmail.com>
> ntel-bug-id: https://jira.hpdd.intel.com/browse/LU-6245

"ntel-bug-id:"?  :)

^ permalink raw reply	[flat|nested] 9+ messages in thread

* RE: [lustre-devel] [PATCH 2/6] staging: lustre: libcfs: move memory_pressure functions to libcfs_prim.h
  2016-03-31 20:03   ` Greg Kroah-Hartman
@ 2016-03-31 20:33     ` Simmons, James A.
  0 siblings, 0 replies; 9+ messages in thread
From: Simmons, James A. @ 2016-03-31 20:33 UTC (permalink / raw)
  To: 'Greg Kroah-Hartman', James Simmons
  Cc: devel, James Simmons, Linux Kernel Mailing List, Oleg Drokin,
	Lustre Development List

>On Thu, Mar 31, 2016 at 10:18:36AM -0400, James Simmons wrote:
>> Long ago libcfs_prim.h was used for userland code which is why
>> memory_pressure_*() handling is in both libcfs_prim.h and
>> linux-mem.h headers. So lets just move the memory_pressure_*()
>> to libcfs_prim.h.
>> 
>> Signed-off-by: James Simmons <uja.ornl@gmail.com>
>> ntel-bug-id: https://jira.hpdd.intel.com/browse/LU-6245
>
>"ntel-bug-id:"?  :)

Thanks for fixing that.

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2016-03-31 20:33 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-03-31 14:18 [PATCH 0/6] cleanup libcfs memory handling James Simmons
2016-03-31 14:18 ` [PATCH 1/6] staging: lustre: libcfs: move add_wait_queue_exclusive_head to lustre layer James Simmons
2016-03-31 14:18 ` [PATCH 2/6] staging: lustre: libcfs: move memory_pressure functions to libcfs_prim.h James Simmons
2016-03-31 20:03   ` Greg Kroah-Hartman
2016-03-31 20:33     ` [lustre-devel] " Simmons, James A.
2016-03-31 14:18 ` [PATCH 3/6] staging: lustre: libcfs: remove page_index() macro James Simmons
2016-03-31 14:18 ` [PATCH 4/6] staging: lustre: libcfs: remove MMSPACE macros James Simmons
2016-03-31 14:18 ` [PATCH 5/6] staging: lustre: libcfs: move NUM_CACHEPAGES to libcfs_prim.h James Simmons
2016-03-31 14:18 ` [PATCH 6/6] staging: lustre: libcfs: delete linux-mem.h James Simmons

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).