From: Pasha Tatashin <pasha.tatashin@oracle.com>
To: Michal Hocko <mhocko@kernel.org>
Cc: akpm@linux-foundation.org, linux-kernel@vger.kernel.org,
linux-mm@kvack.org, Michael Ellerman <mpe@ellerman.id.au>
Subject: Re: [v4 1/1] mm: Adaptive hash table scaling
Date: Mon, 22 May 2017 09:18:58 -0400 [thread overview]
Message-ID: <f6585e67-1640-daa3-370c-f37562cb5245@oracle.com> (raw)
In-Reply-To: <20170522092910.GD8509@dhcp22.suse.cz>
>
> I have only noticed this email today because my incoming emails stopped
> syncing since Friday. But this is _definitely_ not the right approachh.
> 64G for 32b systems is _way_ off. We have only ~1G for the kernel. I've
> already proposed scaling up to 32M for 32b systems and Andi seems to be
> suggesting the same. So can we fold or apply the following instead?
Hi Michal,
Thank you for your suggestion. I will update the patch.
64G base for 32bit systems is not meant to be ever used, as the adaptive
scaling for 32bit system is just not needed. 32M and 64G are going to be
exactly the same on such systems.
Here is theoretical limit for the max hash size of entries (dentry cache
example):
size of bucket: sizeof(struct hlist_bl_head) = 4 bytes
numentries: (1 << 32) / PAGE_SIZE = 1048576 (for 4K pages)
hash size: 4b * 1048576 = 4M
In practice it is going to be an order smaller, as number of kernel
pages is less then (1<<32).
However, I will apply your suggestions as there seems to be a problem of
overflowing in comparing ul vs. ull as reported by Michael Ellerman, and
having a large base on 32bit systems will solve this issue. I will
revert back to "ul" all the quantities.
Another approach is to make it a 64 bit only macro like this:
#if __BITS_PER_LONG > 32
#define ADAPT_SCALE_BASE (64ull << 30)
#define ADAPT_SCALE_SHIFT 2
#define ADAPT_SCALE_NPAGES (ADAPT_SCALE_BASE >> PAGE_SHIFT)
#define adapt_scale(high_limit, numentries, scalep)
if (!(high_limit)) { \
unsigned long adapt; \
for (adapt = ADAPT_SCALE_NPAGES; adapt < \
(numentries); adapt <<= ADAPT_SCALE_SHIFT) \
(*(scalep))++; \
}
#else
#define adapt_scale(high_limit, numentries scalep)
#endif
Pasha
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
next prev parent reply other threads:[~2017-05-22 13:19 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-05-20 17:06 [v4 0/1] mm: Adaptive hash table scaling Pavel Tatashin
2017-05-20 17:06 ` [v4 1/1] " Pavel Tatashin
2017-05-21 2:07 ` Andi Kleen
2017-05-21 12:58 ` Pasha Tatashin
2017-05-21 16:35 ` Andi Kleen
2017-05-22 6:17 ` Michael Ellerman
2017-05-22 9:29 ` Michal Hocko
2017-05-22 13:18 ` Pasha Tatashin [this message]
2017-05-22 13:38 ` Michal Hocko
2017-05-22 13:41 ` Pasha Tatashin
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=f6585e67-1640-daa3-370c-f37562cb5245@oracle.com \
--to=pasha.tatashin@oracle.com \
--cc=akpm@linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mhocko@kernel.org \
--cc=mpe@ellerman.id.au \
/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;
as well as URLs for NNTP newsgroup(s).