lkml.org 
[lkml]   [2018]   [Feb]   [12]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 2/4 v6] lib: debugobjects: add global free list and the counter
On Tue, 6 Feb 2018, Yang Shi wrote:
> + /*
> + * The objs on the pool list might be allocated before the work is
> + * run, so recheck if pool list it full or not, if not fill pool
> + * list from the global free list
> + */
> + while (obj_pool_free < debug_objects_pool_size) {
> + if (obj_nr_tofree <= 0)
> + break;
> +
> + obj = hlist_entry(obj_to_free.first, typeof(*obj), node);
> + hlist_del(&obj->node);
> + hlist_add_head(&obj->node, &obj_pool);
> + obj_pool_free++;
> + obj_nr_tofree--;
> + }
> +
> + /*
> + * pool list is already full, and there are still objs on the free list,
> + * move remaining free objs to a separate list to free the memory later.
> + */
> + if (obj_nr_tofree > 0) {
> + hlist_move_list(&obj_to_free, &tofree);
> + obj_nr_tofree = 0;
> + }
> +
> while (obj_pool_free >= debug_objects_pool_size + ODEBUG_FREE_BATCH) {
> for (i = 0; i < ODEBUG_FREE_BATCH; i++) {
> objs[i] = hlist_entry(obj_pool.first,

This whole section is now pointless and can be removed. There is no way
that this code path can be entered after this change. Surplus objects are
on the obj_to_free list and not on the obj_pool itself.

Thanks,

tglx

\
 
 \ /
  Last update: 2018-02-12 16:52    [W:0.156 / U:5.028 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site