2018-03-11 12:26:52

by Roman Lakeev

[permalink] [raw]
Subject: [PATCH] mm/slab.c: remove duplicated check of colour_next

Date: Sun, 11 Mar 2018 11:05:29 +0300
Signed-off-by: Roman Lakeev <[email protected]>
remove check that offset greater than cachep->colour
bacause this is already checked in previous lines

---
mm/slab.c | 6 +-----
1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/mm/slab.c b/mm/slab.c
index 324446621b3e..6a48f122bd82 100644
--- a/mm/slab.c
+++ b/mm/slab.c
@@ -2674,11 +2674,7 @@ static struct page *cache_grow_begin(struct kmem_cache *cachep,
if (n->colour_next >= cachep->colour)
n->colour_next = 0;

- offset = n->colour_next;
- if (offset >= cachep->colour)
- offset = 0;
-
- offset *= cachep->colour_off;
+ offset = n->colour_next * cachep->colour_off;

/* Get slab management. */
freelist = alloc_slabmgmt(cachep, page, offset,
--
2.16.2



2018-03-11 12:44:23

by Roman Lakeev

[permalink] [raw]
Subject: [PATCH] mm/slab.c: remove duplicated check of colour_next

Sorry for strange message in previous mail.

remove check that offset greater than cachep->colour
bacause this is already checked in previous lines

Signed-off-by: Roman Lakeev <[email protected]>
---
mm/slab.c | 6 +-----
1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/mm/slab.c b/mm/slab.c
index 324446621b3e..6a48f122bd82 100644
--- a/mm/slab.c
+++ b/mm/slab.c
@@ -2674,11 +2674,7 @@ static struct page *cache_grow_begin(struct kmem_cache *cachep,
if (n->colour_next >= cachep->colour)
n->colour_next = 0;

- offset = n->colour_next;
- if (offset >= cachep->colour)
- offset = 0;
-
- offset *= cachep->colour_off;
+ offset = n->colour_next * cachep->colour_off;

/* Get slab management. */
freelist = alloc_slabmgmt(cachep, page, offset,
--
2.16.2

2018-03-11 19:50:53

by David Rientjes

[permalink] [raw]
Subject: Re: [PATCH] mm/slab.c: remove duplicated check of colour_next

On Sun, 11 Mar 2018, Roman Lakeev wrote:

> Sorry for strange message in previous mail.
>
> remove check that offset greater than cachep->colour
> bacause this is already checked in previous lines
>
> Signed-off-by: Roman Lakeev <[email protected]>

Acked-by: David Rientjes <[email protected]>