Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 255045
b: refs/heads/master
c: c4089f9
h: refs/heads/master
i:
  255043: e9aacd1
v: v3
  • Loading branch information
Marcin Slusarz authored and Pekka Enberg committed Jul 7, 2011
1 parent af52d18 commit 67487d3
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 3 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: d18a90dd85f8243ed20cdadb6d8a37d595df456d
refs/heads/master: c4089f98e943ff445665dea49c190657b34ccffe
36 changes: 34 additions & 2 deletions trunk/mm/slub.c
Original file line number Diff line number Diff line change
Expand Up @@ -589,17 +589,49 @@ static void init_object(struct kmem_cache *s, void *object, u8 val)
memset(p + s->objsize, val, s->inuse - s->objsize);
}

static u8 *check_bytes(u8 *start, unsigned int value, unsigned int bytes)
static u8 *check_bytes8(u8 *start, u8 value, unsigned int bytes)
{
while (bytes) {
if (*start != (u8)value)
if (*start != value)
return start;
start++;
bytes--;
}
return NULL;
}

static u8 *check_bytes(u8 *start, u8 value, unsigned int bytes)
{
u64 value64;
unsigned int words, prefix;

if (bytes <= 16)
return check_bytes8(start, value, bytes);

value64 = value | value << 8 | value << 16 | value << 24;
value64 = value64 | value64 << 32;
prefix = 8 - ((unsigned long)start) % 8;

if (prefix) {
u8 *r = check_bytes8(start, value, prefix);
if (r)
return r;
start += prefix;
bytes -= prefix;
}

words = bytes / 8;

while (words) {
if (*(u64 *)start != value64)
return check_bytes8(start, value, 8);
start += 8;
words--;
}

return check_bytes8(start, value, bytes % 8);
}

static void restore_bytes(struct kmem_cache *s, char *message, u8 data,
void *from, void *to)
{
Expand Down

0 comments on commit 67487d3

Please sign in to comment.