On Fri, 2 Feb 2018, Yang Shi wrote:
> On 2/1/18 3:01 PM, Yang Shi wrote:
> > On 2/1/18 1:36 PM, Thomas Gleixner wrote:
> > > The accounting is inconsistent. You leak obj_pool_used. But that's wrong
> > > anyway because an object should not be accounted for in two places. It's
> > > only on _ONE_ list....
> > 
> > So I should move the accounting to where the obj is deleted from the list?
> > It should look like:
> 
> I got your point here. Yes, obj_pool_used should be not decreased here since
> it has not been allocated from pool list.
> 
> But, I think obj_nr_tofree counter should be cleared since all the objs are
> *NOT* on the global free list anymore. They will be freed later. And, we can't
> decrease the obj_nr_tofree counter later without acquiring pool lock.

Right, when you split the list to the temporary tofree list head then you
need to reset obj_nr_tofree as well. And that's correct because the objects
are not longer reachable through one of the global lists.

> > > static bool __free_object(obj)
> > > {
> > >     bool work;
> > > 
> > >     lock(pool);
> > >     work = obj_pool_free > debug_objects_pool_size && obj_cache;
> > >     obj_pool_used++;
> 
> Should it be decreased here since the obj is being dequeued from hlist?

I guess so :)

Thanks,

        tglx

Reply via email to