Re: [PATCH v3] mm/slub: Fix incorrect interpretation of s->offset

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> In a couple of places in the slub memory allocator, the code uses
> "s->offset" as a check to see if the free pointer is put right after the
> object. That check is no longer true with commit 3202fa62fb43 ("slub:
> relocate freelist pointer to middle of object").

Will any further collateral evolution become interesting?


…
> +++ b/mm/slub.c
> @@ -551,15 +551,32 @@ static void print_section(char *level, char *text, u8 *addr,
…
> +static inline unsigned int get_info_end(struct kmem_cache *s)
> +{
> +	if (freeptr_outside_object(s))
> +		return s->inuse + sizeof(void *);
> +	else
> +		return s->inuse;
> +}

How do you think about the following source code variants?

+	return freeptr_outside_object(s)
+	       ? s->inuse + sizeof(void *)
+	       : s->inuse;


>  static struct track *get_track(struct kmem_cache *s, void *object,
>  	enum track_item alloc)
>  {
>  	struct track *p;
>
> -	if (s->offset)
> -		p = object + s->offset + sizeof(void *);
> -	else
> -		p = object + s->inuse;
> +	p = object + get_info_end(s);
>
>  	return p + alloc;
>  }

+	struct track *p = object + get_info_end(s);

 	return p + alloc;


Regards,
Markus





[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux