Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1309011 > unrolled thread
| Started by | Joonsoo Kim <js1304@gmail.com> |
|---|---|
| First post | 2016-01-14 06:30 +0100 |
| Last post | 2016-01-14 17:30 +0100 |
| Articles | 3 — 2 participants |
Back to article view | Back to linux.kernel
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
[PATCH 03/16] mm/slab: remove the checks for slab implementation bug Joonsoo Kim <js1304@gmail.com> - 2016-01-14 06:30 +0100
Re: [PATCH 03/16] mm/slab: remove the checks for slab implementation bug Christoph Lameter <cl@linux.com> - 2016-01-14 16:30 +0100
Re: [PATCH 03/16] mm/slab: remove the checks for slab implementation bug Joonsoo Kim <js1304@gmail.com> - 2016-01-14 17:30 +0100
| From | Joonsoo Kim <js1304@gmail.com> |
|---|---|
| Date | 2016-01-14 06:30 +0100 |
| Subject | [PATCH 03/16] mm/slab: remove the checks for slab implementation bug |
| Message-ID | <qQIDU-2oH-1@gated-at.bofh.it> |
Some of "#if DEBUG" are for reporting slab implementation bug
rather than user usecase bug. It's not really needed because slab
is stable for a quite long time and it makes code too dirty. This
patch remove it.
Signed-off-by: Joonsoo Kim <iamjoonsoo.kim@lge.com>
---
mm/slab.c | 29 +++++++----------------------
1 file changed, 7 insertions(+), 22 deletions(-)
diff --git a/mm/slab.c b/mm/slab.c
index 1bc6294..bbe4df2 100644
--- a/mm/slab.c
+++ b/mm/slab.c
@@ -2110,8 +2110,6 @@ __kmem_cache_create (struct kmem_cache *cachep, unsigned long flags)
if (!(flags & SLAB_DESTROY_BY_RCU))
flags |= SLAB_POISON;
#endif
- if (flags & SLAB_DESTROY_BY_RCU)
- BUG_ON(flags & SLAB_POISON);
#endif
/*
@@ -2368,9 +2366,6 @@ static int drain_freelist(struct kmem_cache *cache,
}
page = list_entry(p, struct page, lru);
-#if DEBUG
- BUG_ON(page->active);
-#endif
list_del(&page->lru);
/*
* Safe to drop the lock. The slab is no longer linked
@@ -2528,30 +2523,23 @@ static void kmem_flagcheck(struct kmem_cache *cachep, gfp_t flags)
}
}
-static void *slab_get_obj(struct kmem_cache *cachep, struct page *page,
- int nodeid)
+static void *slab_get_obj(struct kmem_cache *cachep, struct page *page)
{
void *objp;
objp = index_to_obj(cachep, page, get_free_obj(page, page->active));
page->active++;
-#if DEBUG
- WARN_ON(page_to_nid(virt_to_page(objp)) != nodeid);
-#endif
return objp;
}
-static void slab_put_obj(struct kmem_cache *cachep, struct page *page,
- void *objp, int nodeid)
+static void slab_put_obj(struct kmem_cache *cachep,
+ struct page *page, void *objp)
{
unsigned int objnr = obj_to_index(cachep, page, objp);
#if DEBUG
unsigned int i;
- /* Verify that the slab belongs to the intended node */
- WARN_ON(page_to_nid(virt_to_page(objp)) != nodeid);
-
/* Verify double free bug */
for (i = page->active; i < cachep->num; i++) {
if (get_free_obj(page, i) == objnr) {
@@ -2817,8 +2805,7 @@ retry:
STATS_INC_ACTIVE(cachep);
STATS_SET_HIGH(cachep);
- ac_put_obj(cachep, ac, slab_get_obj(cachep, page,
- node));
+ ac_put_obj(cachep, ac, slab_get_obj(cachep, page));
}
/* move slabp to correct slabp list: */
@@ -3109,7 +3096,7 @@ retry:
BUG_ON(page->active == cachep->num);
- obj = slab_get_obj(cachep, page, nodeid);
+ obj = slab_get_obj(cachep, page);
n->free_objects--;
/* move slabp to correct slabp list: */
list_del(&page->lru);
@@ -3278,7 +3265,7 @@ static void free_block(struct kmem_cache *cachep, void **objpp,
page = virt_to_head_page(objp);
list_del(&page->lru);
check_spinlock_acquired_node(cachep, node);
- slab_put_obj(cachep, page, objp, node);
+ slab_put_obj(cachep, page, objp);
STATS_DEC_ACTIVE(cachep);
n->free_objects++;
@@ -3308,9 +3295,7 @@ static void cache_flusharray(struct kmem_cache *cachep, struct array_cache *ac)
LIST_HEAD(list);
batchcount = ac->batchcount;
-#if DEBUG
- BUG_ON(!batchcount || batchcount > ac->avail);
-#endif
+
check_irq_off();
n = get_node(cachep, node);
spin_lock(&n->list_lock);
--
1.9.1
[toc] | [next] | [standalone]
| From | Christoph Lameter <cl@linux.com> |
|---|---|
| Date | 2016-01-14 16:30 +0100 |
| Subject | Re: [PATCH 03/16] mm/slab: remove the checks for slab implementation bug |
| Message-ID | <qQS0y-uX-19@gated-at.bofh.it> |
| In reply to | #1309011 |
On Thu, 14 Jan 2016, Joonsoo Kim wrote: > Some of "#if DEBUG" are for reporting slab implementation bug > rather than user usecase bug. It's not really needed because slab > is stable for a quite long time and it makes code too dirty. This > patch remove it. Maybe better convert them to VM_BUG_ON() or so?
[toc] | [prev] | [next] | [standalone]
| From | Joonsoo Kim <js1304@gmail.com> |
|---|---|
| Date | 2016-01-14 17:30 +0100 |
| Message-ID | <qQSWE-197-59@gated-at.bofh.it> |
| In reply to | #1309392 |
2016-01-15 0:23 GMT+09:00 Christoph Lameter <cl@linux.com>: > On Thu, 14 Jan 2016, Joonsoo Kim wrote: > >> Some of "#if DEBUG" are for reporting slab implementation bug >> rather than user usecase bug. It's not really needed because slab >> is stable for a quite long time and it makes code too dirty. This >> patch remove it. > > Maybe better convert them to VM_BUG_ON() or so? It's one possible solution but I'd like to make slab.c clean as much as possible. Nowadays, SLAB code isn't changed so much, therefore I don't think we need to keep them. Thanks.
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web