From: Thomas Gleixner <tglx@linutronix.de>
To: Yang Shi <yang.shi@linux.alibaba.com>
Cc: longman@redhat.com, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2/2 v5] lib: debugobjects: handle objects free in a batch outside the loop
Date: Fri, 2 Feb 2018 21:44:04 +0100 (CET) [thread overview]
Message-ID: <alpine.DEB.2.21.1802022141390.1472@nanos.tec.linutronix.de> (raw)
In-Reply-To: <af314f63-1a6b-c2cb-95d9-59b1e4ff674d@linux.alibaba.com>
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
prev parent reply other threads:[~2018-02-02 20:44 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-02-01 18:15 [PATCH 1/2 v5] lib: debugobjects: export max loops counter Yang Shi
2018-02-01 18:15 ` [PATCH 2/2 v5] lib: debugobjects: handle objects free in a batch outside the loop Yang Shi
2018-02-01 21:36 ` Thomas Gleixner
2018-02-01 23:01 ` Yang Shi
2018-02-02 19:52 ` Yang Shi
2018-02-02 20:44 ` Thomas Gleixner [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=alpine.DEB.2.21.1802022141390.1472@nanos.tec.linutronix.de \
--to=tglx@linutronix.de \
--cc=linux-kernel@vger.kernel.org \
--cc=longman@redhat.com \
--cc=yang.shi@linux.alibaba.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®