lkml.org 
[lkml]   [2019]   [Jan]   [11]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] net/core/neighbour: tell kmemleak about hash tables
On Fri, Jan 11, 2019 at 07:26:09AM +0300, Konstantin Khlebnikov wrote:
> On Thu, Jan 10, 2019 at 11:45 PM Cong Wang <xiyou.wangcong@gmail.com> wrote:
> > On Tue, Jan 8, 2019 at 1:30 AM Konstantin Khlebnikov
> > <khlebnikov@yandex-team.ru> wrote:
> > > @@ -443,12 +444,14 @@ static struct neigh_hash_table *neigh_hash_alloc(unsigned int shift)
> > > ret = kmalloc(sizeof(*ret), GFP_ATOMIC);
> > > if (!ret)
> > > return NULL;
> > > - if (size <= PAGE_SIZE)
> > > + if (size <= PAGE_SIZE) {
> > > buckets = kzalloc(size, GFP_ATOMIC);
> > > - else
> > > + } else {
> > > buckets = (struct neighbour __rcu **)
> > > __get_free_pages(GFP_ATOMIC | __GFP_ZERO,
> > > get_order(size));
> > > + kmemleak_alloc(buckets, size, 0, GFP_ATOMIC);
> >
> > Why min_count is 0 rather than 1 here?
>
> The api isn't clear and I've misread description.
> So it should be 1 for reporting leak of hash table itself.
> But 0 doesn't add any new issues.

Correct. I'd say it makes sense to set it to 1 so that you'd have
similar behaviour to the kzalloc() allocation.


--
Catalin

\
 
 \ /
  Last update: 2019-01-11 11:57    [W:0.078 / U:0.288 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site