public inbox for b.a.t.m.a.n@lists.open-mesh.org
 help / color / mirror / Atom feed
From: Sven Eckelmann <sven@narfation.org>
To: b.a.t.m.a.n@lists.open-mesh.org
Subject: Re: [B.A.T.M.A.N.] kmalloc() vs. kmem_cache_alloc() for global TT?
Date: Sun, 15 May 2016 22:50:20 +0200	[thread overview]
Message-ID: <10164043.KPuzFIC6Pp@sven-edge> (raw)
In-Reply-To: <20160515124138.GI4375@otheros>

[-- Attachment #1: Type: text/plain, Size: 2346 bytes --]

On Sunday 15 May 2016 14:41:38 Linus Lüssing wrote:
> On Sun, May 15, 2016 at 02:06:26PM +0200, Linus Lüssing wrote:
> > Ok, yes, that's what I had looked at yesterday, too.
> 
> Btw., these were the results from slabinfo I got yesterday. The
> first one before applying the patches, the second one after:
> 
> http://metameute.de/~tux/batman-adv/slablog/before/
> http://metameute.de/~tux/batman-adv/slablog/after/
> 
> The first number is the number of lines from "batctl tg", second
> one the timestamp.

Hm, looks like the the biggest difference is in kmalloc-64. So this would mean 
that the kmalloc version uses 64 byte entries for tg entries. And the 
batadv_tt_global_cache version uses 192 bytes (so it has an even larger 
overhead). The question is now - why?

My first guess was that you you are using ar71xx with MIPS_L1_CACHE_SHIFT == 
5. This would cause a cache_line_size() of 32. The tg object is 48 bytes on 
ar71xx. So it looks like you are using a different architecture [1] because 
otherwise the (cache) alignment would also be 64 bytes. Maybe you have some 
debug things enabled that cause the extra used bytes?

Extra debug information would also explain it why bridge_fdb_cache requires 
128 bytes (cache aligned) per net_bridge_fdb_entry. I would have expected that 
it is not using more than 64 bytes and is merged automatically together with 
something like kmalloc-64 (see __kmem_cache_alias for the code merging 
different kmem_caches).


Just some thoughts about the kmem_cache approach: We would only have a benefit 
by using kmem_cache when we could have a objsize which is smaller than any 
available slub/slab kmalloc-*. Otherwise slub/slab would automatically use a 
good fitting, internal kmem_cache for everything.

Right now, the size of a tg entry on my system (ar71xx mips, amd64) would have 
a raw size of 48-80 bytes. These would end up at an objsize (cache line 
aligned) of 64-96 bytes. On OpenWrt (ar71xx) it should be merged with 
kmalloc-64 and on Debian (amd64) it should be merged with kmalloc-96 (not 
tested - but maybe it is important to mention that kmalloc-96 has an objsize 
of 128 on my running system).

Kind regards,
	Sven

[1] Yes, I saw the kvm and ACPI lines after I wrote this stuff. So you are
    most likely testing on some x86 system

[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

  reply	other threads:[~2016-05-15 20:50 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-05-14 14:51 [B.A.T.M.A.N.] kmalloc() vs. kmem_cache_alloc() for global TT? Linus Lüssing
2016-05-14 14:54 ` Linus Lüssing
2016-05-15 11:27 ` Sven Eckelmann
2016-05-15 12:06   ` Linus Lüssing
2016-05-15 12:15     ` Sven Eckelmann
2016-05-15 12:17       ` Sven Eckelmann
2016-05-15 12:37       ` Linus Lüssing
2016-05-15 12:53         ` Sven Eckelmann
2016-05-15 12:41     ` Linus Lüssing
2016-05-15 20:50       ` Sven Eckelmann [this message]
2016-05-15 21:26         ` Linus Lüssing
2016-05-15 22:06           ` Sven Eckelmann
2016-05-24  0:14 ` Linus Lüssing

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=10164043.KPuzFIC6Pp@sven-edge \
    --to=sven@narfation.org \
    --cc=b.a.t.m.a.n@lists.open-mesh.org \
    /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