Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1226259 > unrolled thread
| Started by | green@linuxhacker.ru |
|---|---|
| First post | 2015-09-16 18:30 +0200 |
| Last post | 2015-09-16 18:40 +0200 |
| Articles | 10 — 1 participant |
Back to article view | Back to linux.kernel
[PATCH v2 00/19] Lustre cleanups green@linuxhacker.ru - 2015-09-16 18:30 +0200
[PATCH v2 16/19] staging/lustre: remove obd_memory stats counter green@linuxhacker.ru - 2015-09-16 18:30 +0200
[PATCH v2 10/19] staging/lustre/ptlrpc: Replace OBD_FREE_PTR with kfree green@linuxhacker.ru - 2015-09-16 18:40 +0200
[PATCH v2 07/19] staging/lustre: Remove references to OBD_ALLOC/FREE* in comments green@linuxhacker.ru - 2015-09-16 18:40 +0200
[PATCH v2 02/19] staging/lustre: Remove unused OBD_VMALLOC green@linuxhacker.ru - 2015-09-16 18:40 +0200
[PATCH v2 04/19] staging/lustre: Remove users of OBD_ALLOC/FREE_PTR lu_object.h green@linuxhacker.ru - 2015-09-16 18:40 +0200
[PATCH v2 03/19] staging/lustre: Remove unused OBD_CPT_ALLOC* macros green@linuxhacker.ru - 2015-09-16 18:40 +0200
[PATCH v2 15/19] staging/lustre: Remove lustre used memory tracking framework green@linuxhacker.ru - 2015-09-16 18:40 +0200
[PATCH v2 08/19] staging/lustre/fld: Replace OBD_ALLOC_GFP with kzalloc green@linuxhacker.ru - 2015-09-16 18:40 +0200
[PATCH v2 11/19] staging/lustre: Replace last users of OBD_ALLOC/FREE_LARGE green@linuxhacker.ru - 2015-09-16 18:40 +0200
| From | green@linuxhacker.ru |
|---|---|
| Date | 2015-09-16 18:30 +0200 |
| Subject | [PATCH v2 00/19] Lustre cleanups |
| Message-ID | <q9nKO-1iB-11@gated-at.bofh.it> |
From: Oleg Drokin <green@linuxhacker.ru> This bunch of patches removes significant chunks of Lustre specific allocators which is possible thanks to prior patches from Julia Lawall. Also removed are some server-only bits of code that make no sense to retain in a client. Please consider. The v2 version fixes build error in patch 17 without patch 18. Oleg Drokin (19): staging/lustre: Remove OBD_CPT_ALLOC_LARGE staging/lustre: Remove unused OBD_VMALLOC staging/lustre: Remove unused OBD_CPT_ALLOC* macros staging/lustre: Remove users of OBD_ALLOC/FREE_PTR lu_object.h staging/lustre/llite: Get rid of OBD_ALLOC/FREE_PTR staging/lustre/obdclass: replace OBD_ALLOC_GFP with kzalloc staging/lustre: Remove references to OBD_ALLOC/FREE* in comments staging/lustre/fld: Replace OBD_ALLOC_GFP with kzalloc staging/lustre: Convert lustre_cfg_new/free to use kzalloc/kfree staging/lustre/ptlrpc: Replace OBD_FREE_PTR with kfree staging/lustre: Replace last users of OBD_ALLOC/FREE_LARGE staging/lustre: Remove stray bit of userland utils code staging/lustre: Remove unused OBD_ALLOC* and OBD_FREE macros staging/lustre: Remove memory allocation fault injection framework staging/lustre: Remove lustre used memory tracking framework staging/lustre: remove obd_memory stats counter staging/lustre: Remove IS_SERVER and all users staging/lustre: remove IS_MDS|IS_OST|IS_MGS defines and users staging/lustre: Remove server defines from lustre_disk.h drivers/staging/lustre/lustre/fld/fld_cache.c | 2 +- drivers/staging/lustre/lustre/include/lu_object.h | 4 +- drivers/staging/lustre/lustre/include/lustre_cfg.h | 6 +- .../staging/lustre/lustre/include/lustre_disk.h | 142 --------------- drivers/staging/lustre/lustre/include/lustre_lib.h | 4 +- drivers/staging/lustre/lustre/include/lustre_net.h | 2 +- drivers/staging/lustre/lustre/include/obd.h | 12 +- .../staging/lustre/lustre/include/obd_support.h | 198 +-------------------- drivers/staging/lustre/lustre/llite/file.c | 2 +- drivers/staging/lustre/lustre/llite/llite_lib.c | 2 +- drivers/staging/lustre/lustre/mgc/mgc_request.c | 44 +---- drivers/staging/lustre/lustre/obdclass/cl_page.c | 3 +- drivers/staging/lustre/lustre/obdclass/class_obd.c | 103 ----------- .../staging/lustre/lustre/obdclass/llog_internal.h | 8 - .../lustre/lustre/obdclass/lprocfs_counters.c | 9 - .../lustre/lustre/obdclass/lprocfs_status.c | 2 +- drivers/staging/lustre/lustre/obdclass/obd_mount.c | 91 ++-------- .../staging/lustre/lustre/ptlrpc/lproc_ptlrpc.c | 2 +- drivers/staging/lustre/lustre/ptlrpc/pinger.c | 2 - .../staging/lustre/lustre/ptlrpc/ptlrpc_internal.h | 2 +- drivers/staging/lustre/lustre/ptlrpc/service.c | 6 +- 21 files changed, 46 insertions(+), 600 deletions(-) -- 2.1.0 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[toc] | [next] | [standalone]
| From | green@linuxhacker.ru |
|---|---|
| Date | 2015-09-16 18:30 +0200 |
| Subject | [PATCH v2 16/19] staging/lustre: remove obd_memory stats counter |
| Message-ID | <q9nKQ-1iB-65@gated-at.bofh.it> |
| In reply to | #1226259 |
From: Oleg Drokin <green@linuxhacker.ru>
Now that we no longer track allocated memory, remove
obd_memory statistics counter and all references to it everywhere
Signed-off-by: Oleg Drokin <oleg.drokin@intel.com>
---
drivers/staging/lustre/lustre/include/obd_support.h | 7 -------
drivers/staging/lustre/lustre/obdclass/class_obd.c | 18 ------------------
.../staging/lustre/lustre/obdclass/lprocfs_counters.c | 9 ---------
.../staging/lustre/lustre/obdclass/lprocfs_status.c | 2 +-
4 files changed, 1 insertion(+), 35 deletions(-)
diff --git a/drivers/staging/lustre/lustre/include/obd_support.h b/drivers/staging/lustre/lustre/include/obd_support.h
index 62d76b5..80ab85d 100644
--- a/drivers/staging/lustre/lustre/include/obd_support.h
+++ b/drivers/staging/lustre/lustre/include/obd_support.h
@@ -43,13 +43,6 @@
#include "lprocfs_status.h"
/* global variables */
-extern struct lprocfs_stats *obd_memory;
-enum {
- OBD_MEMORY_STAT = 0,
- OBD_MEMORY_PAGES_STAT = 1,
- OBD_STATS_NUM,
-};
-
extern unsigned int obd_debug_peer_on_timeout;
extern unsigned int obd_dump_on_timeout;
extern unsigned int obd_dump_on_eviction;
diff --git a/drivers/staging/lustre/lustre/obdclass/class_obd.c b/drivers/staging/lustre/lustre/obdclass/class_obd.c
index 32daefb..39bf734 100644
--- a/drivers/staging/lustre/lustre/obdclass/class_obd.c
+++ b/drivers/staging/lustre/lustre/obdclass/class_obd.c
@@ -487,22 +487,6 @@ static int __init init_obdclass(void)
spin_lock_init(&obd_types_lock);
obd_zombie_impexp_init();
- obd_memory = lprocfs_alloc_stats(OBD_STATS_NUM,
- LPROCFS_STATS_FLAG_NONE |
- LPROCFS_STATS_FLAG_IRQ_SAFE);
-
- if (obd_memory == NULL) {
- CERROR("kmalloc of 'obd_memory' failed\n");
- return -ENOMEM;
- }
-
- lprocfs_counter_init(obd_memory, OBD_MEMORY_STAT,
- LPROCFS_CNTR_AVGMINMAX,
- "memused", "bytes");
- lprocfs_counter_init(obd_memory, OBD_MEMORY_PAGES_STAT,
- LPROCFS_CNTR_AVGMINMAX,
- "pagesused", "pages");
-
err = obd_init_checks();
if (err == -EOVERFLOW)
return err;
@@ -592,8 +576,6 @@ static void cleanup_obdclass(void)
class_handle_cleanup();
class_exit_uuidlist();
obd_zombie_impexp_stop();
-
- lprocfs_free_stats(&obd_memory);
}
MODULE_AUTHOR("Sun Microsystems, Inc. <http://www.lustre.org/>");
diff --git a/drivers/staging/lustre/lustre/obdclass/lprocfs_counters.c b/drivers/staging/lustre/lustre/obdclass/lprocfs_counters.c
index 1f0004c..6acc4a1 100644
--- a/drivers/staging/lustre/lustre/obdclass/lprocfs_counters.c
+++ b/drivers/staging/lustre/lustre/obdclass/lprocfs_counters.c
@@ -41,9 +41,6 @@
#include "../include/lprocfs_status.h"
#include "../include/obd_support.h"
-struct lprocfs_stats *obd_memory;
-EXPORT_SYMBOL(obd_memory);
-
void lprocfs_counter_add(struct lprocfs_stats *stats, int idx, long amount)
{
struct lprocfs_counter *percpu_cntr;
@@ -74,9 +71,6 @@ void lprocfs_counter_add(struct lprocfs_stats *stats, int idx, long amount)
* ldlm_pool_shrink(), which calls lprocfs_counter_add().
* LU-1727.
*
- * Only obd_memory uses LPROCFS_STATS_FLAG_IRQ_SAFE
- * flag, because it needs accurate counting lest memory leak
- * check reports error.
*/
if (in_interrupt() &&
(stats->ls_flags & LPROCFS_STATS_FLAG_IRQ_SAFE) != 0)
@@ -124,9 +118,6 @@ void lprocfs_counter_sub(struct lprocfs_stats *stats, int idx, long amount)
* softirq context here, use separate counter for that.
* bz20650.
*
- * Only obd_memory uses LPROCFS_STATS_FLAG_IRQ_SAFE
- * flag, because it needs accurate counting lest memory leak
- * check reports error.
*/
if (in_interrupt() &&
(stats->ls_flags & LPROCFS_STATS_FLAG_IRQ_SAFE) != 0)
diff --git a/drivers/staging/lustre/lustre/obdclass/lprocfs_status.c b/drivers/staging/lustre/lustre/obdclass/lprocfs_status.c
index 08d1f0e..8d2a523 100644
--- a/drivers/staging/lustre/lustre/obdclass/lprocfs_status.c
+++ b/drivers/staging/lustre/lustre/obdclass/lprocfs_status.c
@@ -1082,7 +1082,7 @@ struct lprocfs_stats *lprocfs_alloc_stats(unsigned int num,
goto fail;
stats->ls_biggest_alloc_num = 1;
} else if ((flags & LPROCFS_STATS_FLAG_IRQ_SAFE) != 0) {
- /* alloc all percpu data, currently only obd_memory use this */
+ /* alloc all percpu data */
for (i = 0; i < num_entry; ++i)
if (lprocfs_stats_alloc_one(stats, i) < 0)
goto fail;
--
2.1.0
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [next] | [standalone]
| From | green@linuxhacker.ru |
|---|---|
| Date | 2015-09-16 18:40 +0200 |
| Subject | [PATCH v2 10/19] staging/lustre/ptlrpc: Replace OBD_FREE_PTR with kfree |
| Message-ID | <q9nUt-1tZ-3@gated-at.bofh.it> |
| In reply to | #1226259 |
From: Oleg Drokin <green@linuxhacker.ru>
Part of effort of getting rid of custom Lustre alloc/free macros
Signed-off-by: Oleg Drokin <oleg.drokin@intel.com>
---
drivers/staging/lustre/lustre/ptlrpc/ptlrpc_internal.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/staging/lustre/lustre/ptlrpc/ptlrpc_internal.h b/drivers/staging/lustre/lustre/ptlrpc/ptlrpc_internal.h
index 1d64ca7..34c7e28 100644
--- a/drivers/staging/lustre/lustre/ptlrpc/ptlrpc_internal.h
+++ b/drivers/staging/lustre/lustre/ptlrpc/ptlrpc_internal.h
@@ -298,6 +298,6 @@ static inline void tgt_mod_exit(void)
static inline void ptlrpc_reqset_put(struct ptlrpc_request_set *set)
{
if (atomic_dec_and_test(&set->set_refcount))
- OBD_FREE_PTR(set);
+ kfree(set);
}
#endif /* PTLRPC_INTERNAL_H */
--
2.1.0
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [next] | [standalone]
| From | green@linuxhacker.ru |
|---|---|
| Date | 2015-09-16 18:40 +0200 |
| Subject | [PATCH v2 07/19] staging/lustre: Remove references to OBD_ALLOC/FREE* in comments |
| Message-ID | <q9nUt-1tZ-9@gated-at.bofh.it> |
| In reply to | #1226259 |
From: Oleg Drokin <green@linuxhacker.ru>
Since everything is now supposed to use regular kernel alloc and
free functions.
Signed-off-by: Oleg Drokin <oleg.drokin@intel.com>
---
drivers/staging/lustre/lustre/include/lustre_lib.h | 2 +-
drivers/staging/lustre/lustre/include/lustre_net.h | 2 +-
drivers/staging/lustre/lustre/llite/file.c | 2 +-
drivers/staging/lustre/lustre/ptlrpc/lproc_ptlrpc.c | 2 +-
4 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/drivers/staging/lustre/lustre/include/lustre_lib.h b/drivers/staging/lustre/lustre/include/lustre_lib.h
index 2a4294d..352e524 100644
--- a/drivers/staging/lustre/lustre/include/lustre_lib.h
+++ b/drivers/staging/lustre/lustre/include/lustre_lib.h
@@ -453,7 +453,7 @@ static inline void obd_ioctl_freedata(char *buf, int len)
* __wake_up_common(q, ...); (2.2)
* spin_unlock(&q->lock, flags); (2.3)
*
- * OBD_FREE_PTR(obj); (3)
+ * kfree(obj); (3)
*
* As l_wait_event() may "short-cut" execution and return without taking
* wait-queue spin-lock, some additional synchronization is necessary to
diff --git a/drivers/staging/lustre/lustre/include/lustre_net.h b/drivers/staging/lustre/lustre/include/lustre_net.h
index 3b6a2d7..c9c21d2 100644
--- a/drivers/staging/lustre/lustre/include/lustre_net.h
+++ b/drivers/staging/lustre/lustre/include/lustre_net.h
@@ -306,7 +306,7 @@ union ptlrpc_async_args {
/**
* Scratchpad for passing args to completion interpreter. Users
* cast to the struct of their choosing, and CLASSERT that this is
- * big enough. For _tons_ of context, OBD_ALLOC a struct and store
+ * big enough. For _tons_ of context, kmalloc a struct and store
* a pointer to it here. The pointer_arg ensures this struct is at
* least big enough for that.
*/
diff --git a/drivers/staging/lustre/lustre/llite/file.c b/drivers/staging/lustre/lustre/llite/file.c
index b610032..31ed248 100644
--- a/drivers/staging/lustre/lustre/llite/file.c
+++ b/drivers/staging/lustre/lustre/llite/file.c
@@ -694,7 +694,7 @@ out_och_free:
if (rc) {
if (och_p && *och_p) {
kfree(*och_p);
- *och_p = NULL; /* OBD_FREE writes some magic there */
+ *och_p = NULL;
(*och_usecount)--;
}
mutex_unlock(&lli->lli_och_mutex);
diff --git a/drivers/staging/lustre/lustre/ptlrpc/lproc_ptlrpc.c b/drivers/staging/lustre/lustre/ptlrpc/lproc_ptlrpc.c
index 84eb3da..9a10baf 100644
--- a/drivers/staging/lustre/lustre/ptlrpc/lproc_ptlrpc.c
+++ b/drivers/staging/lustre/lustre/ptlrpc/lproc_ptlrpc.c
@@ -1223,7 +1223,7 @@ int lprocfs_wr_evict_client(struct file *file, const char __user *buffer,
return -ENOMEM;
/*
- * OBD_ALLOC() will zero kbuf, but we only copy BUFLEN - 1
+ * kzalloc() will zero kbuf, but we only copy BUFLEN - 1
* bytes into kbuf, to ensure that the string is NUL-terminated.
* UUID_MAX should include a trailing NUL already.
*/
--
2.1.0
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [next] | [standalone]
| From | green@linuxhacker.ru |
|---|---|
| Date | 2015-09-16 18:40 +0200 |
| Subject | [PATCH v2 02/19] staging/lustre: Remove unused OBD_VMALLOC |
| Message-ID | <q9nUt-1tZ-13@gated-at.bofh.it> |
| In reply to | #1226259 |
From: Oleg Drokin <green@linuxhacker.ru>
These macros are not used anymore, so let's remove them,
also __OBD_VMALLOC_VEROBSE and OBD_CPT_VMALLOC
Signed-off-by: Oleg Drokin <oleg.drokin@intel.com>
---
.../staging/lustre/lustre/include/obd_support.h | 29 ----------------------
1 file changed, 29 deletions(-)
diff --git a/drivers/staging/lustre/lustre/include/obd_support.h b/drivers/staging/lustre/lustre/include/obd_support.h
index b746763..f58d142 100644
--- a/drivers/staging/lustre/lustre/include/obd_support.h
+++ b/drivers/staging/lustre/lustre/include/obd_support.h
@@ -608,27 +608,6 @@ do { \
#define OBD_CPT_ALLOC_PTR(ptr, cptab, cpt) \
OBD_CPT_ALLOC(ptr, cptab, cpt, sizeof(*(ptr)))
-# define __OBD_VMALLOC_VEROBSE(ptr, cptab, cpt, size) \
-do { \
- (ptr) = cptab == NULL ? \
- vzalloc(size) : \
- vzalloc_node(size, cfs_cpt_spread_node(cptab, cpt)); \
- if (unlikely((ptr) == NULL)) { \
- CERROR("vmalloc of '" #ptr "' (%d bytes) failed\n", \
- (int)(size)); \
- CERROR("%llu total bytes allocated by Lustre\n", \
- obd_memory_sum()); \
- } else { \
- OBD_ALLOC_POST(ptr, size, "vmalloced"); \
- } \
-} while (0)
-
-# define OBD_VMALLOC(ptr, size) \
- __OBD_VMALLOC_VEROBSE(ptr, NULL, 0, size)
-# define OBD_CPT_VMALLOC(ptr, cptab, cpt, size) \
- __OBD_VMALLOC_VEROBSE(ptr, cptab, cpt, size)
-
-
#define OBD_ALLOC_LARGE(ptr, size) \
do { \
ptr = libcfs_kvzalloc(size, GFP_NOFS); \
@@ -677,14 +656,6 @@ do { \
POISON_PTR(ptr); \
} while (0)
-
-#define OBD_VFREE(ptr, size) \
- do { \
- OBD_FREE_PRE(ptr, size, "vfreed"); \
- vfree(ptr); \
- POISON_PTR(ptr); \
- } while (0)
-
/* we memset() the slab object to 0 when allocation succeeds, so DO NOT
* HAVE A CTOR THAT DOES ANYTHING. its work will be cleared here. we'd
* love to assert on that, but slab.c keeps kmem_cache_s all to itself. */
--
2.1.0
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [next] | [standalone]
| From | green@linuxhacker.ru |
|---|---|
| Date | 2015-09-16 18:40 +0200 |
| Subject | [PATCH v2 04/19] staging/lustre: Remove users of OBD_ALLOC/FREE_PTR lu_object.h |
| Message-ID | <q9nUu-1tZ-17@gated-at.bofh.it> |
| In reply to | #1226259 |
From: Oleg Drokin <green@linuxhacker.ru>
These are converted to regular kzalloc/kfree calls.
Signed-off-by: Oleg Drokin <oleg.drokin@intel.com>
---
drivers/staging/lustre/lustre/include/lu_object.h | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/staging/lustre/lustre/include/lu_object.h b/drivers/staging/lustre/lustre/include/lu_object.h
index 96e271d..7756008 100644
--- a/drivers/staging/lustre/lustre/include/lu_object.h
+++ b/drivers/staging/lustre/lustre/include/lu_object.h
@@ -1126,7 +1126,7 @@ struct lu_context_key {
\
CLASSERT(PAGE_CACHE_SIZE >= sizeof (*value)); \
\
- OBD_ALLOC_PTR(value); \
+ value = kzalloc(sizeof(*value), GFP_NOFS); \
if (value == NULL) \
value = ERR_PTR(-ENOMEM); \
\
@@ -1140,7 +1140,7 @@ struct lu_context_key {
{ \
type *info = data; \
\
- OBD_FREE_PTR(info); \
+ kfree(info); \
} \
struct __##mod##__dummy_fini {; } /* semicolon catcher */
--
2.1.0
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [next] | [standalone]
| From | green@linuxhacker.ru |
|---|---|
| Date | 2015-09-16 18:40 +0200 |
| Subject | [PATCH v2 03/19] staging/lustre: Remove unused OBD_CPT_ALLOC* macros |
| Message-ID | <q9nUu-1tZ-21@gated-at.bofh.it> |
| In reply to | #1226259 |
From: Oleg Drokin <green@linuxhacker.ru>
OBD_CPT_ALLOC and friends are no longer used, so remove them.
Signed-off-by: Oleg Drokin <oleg.drokin@intel.com>
---
drivers/staging/lustre/lustre/include/obd_support.h | 9 ---------
1 file changed, 9 deletions(-)
diff --git a/drivers/staging/lustre/lustre/include/obd_support.h b/drivers/staging/lustre/lustre/include/obd_support.h
index f58d142..5ae35fa 100644
--- a/drivers/staging/lustre/lustre/include/obd_support.h
+++ b/drivers/staging/lustre/lustre/include/obd_support.h
@@ -599,15 +599,6 @@ do { \
#define OBD_ALLOC_PTR(ptr) OBD_ALLOC(ptr, sizeof(*(ptr)))
#define OBD_ALLOC_PTR_WAIT(ptr) OBD_ALLOC_WAIT(ptr, sizeof(*(ptr)))
-#define OBD_CPT_ALLOC_GFP(ptr, cptab, cpt, size, gfp_mask) \
- __OBD_MALLOC_VERBOSE(ptr, cptab, cpt, size, gfp_mask)
-
-#define OBD_CPT_ALLOC(ptr, cptab, cpt, size) \
- OBD_CPT_ALLOC_GFP(ptr, cptab, cpt, size, GFP_NOFS)
-
-#define OBD_CPT_ALLOC_PTR(ptr, cptab, cpt) \
- OBD_CPT_ALLOC(ptr, cptab, cpt, sizeof(*(ptr)))
-
#define OBD_ALLOC_LARGE(ptr, size) \
do { \
ptr = libcfs_kvzalloc(size, GFP_NOFS); \
--
2.1.0
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [next] | [standalone]
| From | green@linuxhacker.ru |
|---|---|
| Date | 2015-09-16 18:40 +0200 |
| Subject | [PATCH v2 15/19] staging/lustre: Remove lustre used memory tracking framework |
| Message-ID | <q9nUv-1tZ-25@gated-at.bofh.it> |
| In reply to | #1226259 |
From: Oleg Drokin <green@linuxhacker.ru>
Lustre memory allocation framework has a feature to track amount
of allocated memory, but since it's not being used consistently anymore
and is on the way out in general, just remove it.
Signed-off-by: Oleg Drokin <oleg.drokin@intel.com>
---
.../staging/lustre/lustre/include/obd_support.h | 60 +-------------------
drivers/staging/lustre/lustre/obdclass/class_obd.c | 64 ----------------------
drivers/staging/lustre/lustre/ptlrpc/pinger.c | 2 -
3 files changed, 1 insertion(+), 125 deletions(-)
diff --git a/drivers/staging/lustre/lustre/include/obd_support.h b/drivers/staging/lustre/lustre/include/obd_support.h
index 3d92f19..62d76b5 100644
--- a/drivers/staging/lustre/lustre/include/obd_support.h
+++ b/drivers/staging/lustre/lustre/include/obd_support.h
@@ -494,50 +494,6 @@ extern char obd_jobid_var[];
#define OBD_FAIL_ONCE CFS_FAIL_ONCE
#define OBD_FAILED CFS_FAILED
-void obd_update_maxusage(void);
-
-#define obd_memory_add(size) \
- lprocfs_counter_add(obd_memory, OBD_MEMORY_STAT, (long)(size))
-#define obd_memory_sub(size) \
- lprocfs_counter_sub(obd_memory, OBD_MEMORY_STAT, (long)(size))
-#define obd_memory_sum() \
- lprocfs_stats_collector(obd_memory, OBD_MEMORY_STAT, \
- LPROCFS_FIELDS_FLAGS_SUM)
-#define obd_pages_add(order) \
- lprocfs_counter_add(obd_memory, OBD_MEMORY_PAGES_STAT, \
- (long)(1 << (order)))
-#define obd_pages_sub(order) \
- lprocfs_counter_sub(obd_memory, OBD_MEMORY_PAGES_STAT, \
- (long)(1 << (order)))
-#define obd_pages_sum() \
- lprocfs_stats_collector(obd_memory, OBD_MEMORY_PAGES_STAT, \
- LPROCFS_FIELDS_FLAGS_SUM)
-
-__u64 obd_memory_max(void);
-__u64 obd_pages_max(void);
-
-#define OBD_DEBUG_MEMUSAGE (1)
-
-#if OBD_DEBUG_MEMUSAGE
-#define OBD_ALLOC_POST(ptr, size, name) \
- obd_memory_add(size); \
- CDEBUG(D_MALLOC, name " '" #ptr "': %d at %p.\n", \
- (int)(size), ptr)
-
-#define OBD_FREE_PRE(ptr, size, name) \
- LASSERT(ptr); \
- obd_memory_sub(size); \
- CDEBUG(D_MALLOC, name " '" #ptr "': %d at %p.\n", \
- (int)(size), ptr); \
- POISON(ptr, 0x5a, size)
-
-#else /* !OBD_DEBUG_MEMUSAGE */
-
-#define OBD_ALLOC_POST(ptr, size, name) ((void)0)
-#define OBD_FREE_PRE(ptr, size, name) ((void)0)
-
-#endif /* !OBD_DEBUG_MEMUSAGE */
-
#ifdef CONFIG_DEBUG_SLAB
#define POISON(ptr, c, s) do {} while (0)
#define POISON_PTR(ptr) ((void)0)
@@ -583,8 +539,6 @@ do { \
kmem_cache_alloc(slab, type | __GFP_ZERO) : \
kmem_cache_alloc_node(slab, type | __GFP_ZERO, \
cfs_cpt_spread_node(cptab, cpt)); \
- if (likely(ptr)) \
- OBD_ALLOC_POST(ptr, size, "slab-alloced"); \
} while (0)
#define OBD_SLAB_ALLOC_GFP(ptr, slab, size, flags) \
@@ -594,7 +548,6 @@ do { \
#define OBD_SLAB_FREE(ptr, slab, size) \
do { \
- OBD_FREE_PRE(ptr, size, "slab-freed"); \
kmem_cache_free(slab, ptr); \
POISON_PTR(ptr); \
} while (0)
@@ -629,17 +582,7 @@ do { \
(ptr) = (cptab) == NULL ? \
alloc_page(gfp_mask) : \
alloc_pages_node(cfs_cpt_spread_node(cptab, cpt), gfp_mask, 0);\
- if (unlikely((ptr) == NULL)) { \
- CERROR("alloc_pages of '" #ptr "' %d page(s) / %llu bytes "\
- "failed\n", (int)1, \
- (__u64)(1 << PAGE_CACHE_SHIFT)); \
- CERROR("%llu total bytes and %llu total pages " \
- "(%llu bytes) allocated by Lustre\n", \
- obd_memory_sum(), \
- obd_pages_sum() << PAGE_CACHE_SHIFT, \
- obd_pages_sum()); \
- } else { \
- obd_pages_add(0); \
+ if (ptr) { \
CDEBUG(D_MALLOC, "alloc_pages '" #ptr "': %d page(s) / " \
"%llu bytes at %p.\n", \
(int)1, \
@@ -655,7 +598,6 @@ do { \
#define OBD_PAGE_FREE(ptr) \
do { \
LASSERT(ptr); \
- obd_pages_sub(0); \
CDEBUG(D_MALLOC, "free_pages '" #ptr "': %d page(s) / %llu bytes " \
"at %p.\n", \
(int)1, (__u64)(1 << PAGE_CACHE_SHIFT), \
diff --git a/drivers/staging/lustre/lustre/obdclass/class_obd.c b/drivers/staging/lustre/lustre/obdclass/class_obd.c
index fb4138c..32daefb 100644
--- a/drivers/staging/lustre/lustre/obdclass/class_obd.c
+++ b/drivers/staging/lustre/lustre/obdclass/class_obd.c
@@ -53,16 +53,6 @@ EXPORT_SYMBOL(obd_devs);
struct list_head obd_types;
DEFINE_RWLOCK(obd_dev_lock);
-__u64 obd_max_pages;
-EXPORT_SYMBOL(obd_max_pages);
-__u64 obd_max_alloc;
-EXPORT_SYMBOL(obd_max_alloc);
-__u64 obd_alloc;
-EXPORT_SYMBOL(obd_alloc);
-__u64 obd_pages;
-EXPORT_SYMBOL(obd_pages);
-static DEFINE_SPINLOCK(obd_updatemax_lock);
-
/* The following are visible and mutable through /proc/sys/lustre/. */
unsigned int obd_debug_peer_on_timeout;
EXPORT_SYMBOL(obd_debug_peer_on_timeout);
@@ -572,54 +562,12 @@ static int __init init_obdclass(void)
return err;
}
-void obd_update_maxusage(void)
-{
- __u64 max1, max2;
-
- max1 = obd_pages_sum();
- max2 = obd_memory_sum();
-
- spin_lock(&obd_updatemax_lock);
- if (max1 > obd_max_pages)
- obd_max_pages = max1;
- if (max2 > obd_max_alloc)
- obd_max_alloc = max2;
- spin_unlock(&obd_updatemax_lock);
-}
-EXPORT_SYMBOL(obd_update_maxusage);
-
-__u64 obd_memory_max(void)
-{
- __u64 ret;
-
- spin_lock(&obd_updatemax_lock);
- ret = obd_max_alloc;
- spin_unlock(&obd_updatemax_lock);
-
- return ret;
-}
-EXPORT_SYMBOL(obd_memory_max);
-
-__u64 obd_pages_max(void)
-{
- __u64 ret;
-
- spin_lock(&obd_updatemax_lock);
- ret = obd_max_pages;
- spin_unlock(&obd_updatemax_lock);
-
- return ret;
-}
-EXPORT_SYMBOL(obd_pages_max);
-
/* liblustre doesn't call cleanup_obdclass, apparently. we carry on in this
* ifdef to the end of the file to cover module and versioning goo.*/
static void cleanup_obdclass(void)
{
int i;
int lustre_unregister_fs(void);
- __u64 memory_leaked, pages_leaked;
- __u64 memory_max, pages_max;
lustre_unregister_fs();
@@ -645,19 +593,7 @@ static void cleanup_obdclass(void)
class_exit_uuidlist();
obd_zombie_impexp_stop();
- memory_leaked = obd_memory_sum();
- pages_leaked = obd_pages_sum();
-
- memory_max = obd_memory_max();
- pages_max = obd_pages_max();
-
lprocfs_free_stats(&obd_memory);
- CDEBUG((memory_leaked) ? D_ERROR : D_INFO,
- "obd_memory max: %llu, leaked: %llu\n",
- memory_max, memory_leaked);
- CDEBUG((pages_leaked) ? D_ERROR : D_INFO,
- "obd_memory_pages max: %llu, leaked: %llu\n",
- pages_max, pages_leaked);
}
MODULE_AUTHOR("Sun Microsystems, Inc. <http://www.lustre.org/>");
diff --git a/drivers/staging/lustre/lustre/ptlrpc/pinger.c b/drivers/staging/lustre/lustre/ptlrpc/pinger.c
index d3aea4a..6cd4cfa 100644
--- a/drivers/staging/lustre/lustre/ptlrpc/pinger.c
+++ b/drivers/staging/lustre/lustre/ptlrpc/pinger.c
@@ -266,8 +266,6 @@ static int ptlrpc_pinger_main(void *arg)
ptlrpc_update_next_ping(imp, 0);
}
mutex_unlock(&pinger_mutex);
- /* update memory usage info */
- obd_update_maxusage();
/* Wait until the next ping time, or until we're stopped. */
time_to_next_wake = pinger_check_timeout(this_ping);
--
2.1.0
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [next] | [standalone]
| From | green@linuxhacker.ru |
|---|---|
| Date | 2015-09-16 18:40 +0200 |
| Subject | [PATCH v2 08/19] staging/lustre/fld: Replace OBD_ALLOC_GFP with kzalloc |
| Message-ID | <q9nUv-1tZ-27@gated-at.bofh.it> |
| In reply to | #1226259 |
From: Oleg Drokin <green@linuxhacker.ru>
Part of effort to get rid of custom Lustre allocation macros.
Signed-off-by: Oleg Drokin <oleg.drokin@intel.com>
---
drivers/staging/lustre/lustre/fld/fld_cache.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/staging/lustre/lustre/fld/fld_cache.c b/drivers/staging/lustre/lustre/fld/fld_cache.c
index 1b1066b..5eeb36d 100644
--- a/drivers/staging/lustre/lustre/fld/fld_cache.c
+++ b/drivers/staging/lustre/lustre/fld/fld_cache.c
@@ -266,7 +266,7 @@ static void fld_cache_punch_hole(struct fld_cache *cache,
const u64 new_end = range->lsr_end;
struct fld_cache_entry *fldt;
- OBD_ALLOC_GFP(fldt, sizeof(*fldt), GFP_ATOMIC);
+ fldt = kzalloc(sizeof(*fldt), GFP_ATOMIC);
if (!fldt) {
kfree(f_new);
/* overlap is not allowed, so dont mess up list. */
--
2.1.0
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [next] | [standalone]
| From | green@linuxhacker.ru |
|---|---|
| Date | 2015-09-16 18:40 +0200 |
| Subject | [PATCH v2 11/19] staging/lustre: Replace last users of OBD_ALLOC/FREE_LARGE |
| Message-ID | <q9nUv-1tZ-29@gated-at.bofh.it> |
| In reply to | #1226259 |
From: Oleg Drokin <green@linuxhacker.ru>
OBD_ALLOC_LARGE is now replaced with libcfs_kvzalloc and
OBD_FREE_LARGE is now replaced with kvfree.
Signed-off-by: Oleg Drokin <oleg.drokin@intel.com>
---
drivers/staging/lustre/lustre/include/lustre_lib.h | 2 +-
drivers/staging/lustre/lustre/include/obd.h | 8 ++++----
2 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/drivers/staging/lustre/lustre/include/lustre_lib.h b/drivers/staging/lustre/lustre/include/lustre_lib.h
index 352e524..b380359 100644
--- a/drivers/staging/lustre/lustre/include/lustre_lib.h
+++ b/drivers/staging/lustre/lustre/include/lustre_lib.h
@@ -258,7 +258,7 @@ int obd_ioctl_popdata(void *arg, void *data, int len);
static inline void obd_ioctl_freedata(char *buf, int len)
{
- OBD_FREE_LARGE(buf, len);
+ kvfree(buf);
return;
}
diff --git a/drivers/staging/lustre/lustre/include/obd.h b/drivers/staging/lustre/lustre/include/obd.h
index 1013c33..9c50ef1 100644
--- a/drivers/staging/lustre/lustre/include/obd.h
+++ b/drivers/staging/lustre/lustre/include/obd.h
@@ -728,8 +728,8 @@ static inline void oti_alloc_cookies(struct obd_trans_info *oti,
if (num_cookies == 1)
oti->oti_logcookies = &oti->oti_onecookie;
else
- OBD_ALLOC_LARGE(oti->oti_logcookies,
- num_cookies * sizeof(oti->oti_onecookie));
+ oti->oti_logcookies = libcfs_kvzalloc(num_cookies * sizeof(oti->oti_onecookie),
+ GFP_NOFS);
oti->oti_numcookies = num_cookies;
}
@@ -742,8 +742,8 @@ static inline void oti_free_cookies(struct obd_trans_info *oti)
if (oti->oti_logcookies == &oti->oti_onecookie)
LASSERT(oti->oti_numcookies == 1);
else
- OBD_FREE_LARGE(oti->oti_logcookies,
- oti->oti_numcookies*sizeof(oti->oti_onecookie));
+ kvfree(oti->oti_logcookies);
+
oti->oti_logcookies = NULL;
oti->oti_numcookies = 0;
}
--
2.1.0
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web