[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Tue, 07 Jul 2009 10:12:13 +0300
From: Pekka Enberg <penberg@...helsinki.fi>
To: Catalin Marinas <catalin.marinas@....com>
Cc: linux-mm@...ck.org, linux-kernel@...r.kernel.org,
Ingo Molnar <mingo@...e.hu>, akpm@...ux-foundation.org
Subject: Re: [RFC PATCH 1/3] kmemleak: Allow partial freeing of memory
blocks
On Mon, 2009-07-06 at 11:51 +0100, Catalin Marinas wrote:
> @@ -552,8 +558,29 @@ static void delete_object(unsigned long ptr)
> */
> spin_lock_irqsave(&object->lock, flags);
> object->flags &= ~OBJECT_ALLOCATED;
> + start = object->pointer;
> + end = object->pointer + object->size;
> + min_count = object->min_count;
> spin_unlock_irqrestore(&object->lock, flags);
> put_object(object);
> +
> + if (!size)
> + return;
> +
> + /*
> + * Partial freeing. Just create one or two objects that may result
> + * from the memory block split.
> + */
> + if (in_atomic())
> + gfp_flags = GFP_ATOMIC;
> + else
> + gfp_flags = GFP_KERNEL;
Are you sure we can do this? There's a big fat comment on top of
in_atomic() that suggest this is not safe. Why do we need to create the
object here anyway and not in the _alloc_ paths where gfp flags are
explicitly passed?
> +
> + if (ptr > start)
> + create_object(start, ptr - start, min_count, gfp_flags);
> + if (ptr + size < end)
> + create_object(ptr + size, end - ptr - size, min_count,
> + gfp_flags);
> }
>
> /*
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists