From: Pasha Tatashin <pasha.tatashin@oracle.com>
To: Matthew Wilcox <willy@infradead.org>
Cc: David Miller <davem@davemloft.net>,
linux-mm@kvack.org, sparclinux@vger.kernel.org
Subject: Re: [PATCH v1 1/3] sparc64: NG4 memset/memcpy 32 bits overflow
Date: Tue, 28 Feb 2017 14:34:17 -0500 [thread overview]
Message-ID: <a3a3a887-c7be-eb31-b73f-e179162fde93@oracle.com> (raw)
In-Reply-To: <20170228185914.GF16328@bombadil.infradead.org>
Hi Matthew,
Thank you for your comments, my replies below:
On 02/28/2017 01:59 PM, Matthew Wilcox wrote:
> ... what algorithms are deemed "inefficient" when they take a break every
> 2 billion bytes to, ohidon'tknow, check to see that a higher priority
> process doesn't want the CPU?
I do not see that NG4memcpy() is disabling interrupts so there should
not be any issues with letting higher priority processes to interrupt
and do their work. And, as I said my point was mostly for consideration,
I will revert that bound check in NG4memcpy() to the 2G limit.
> Right, so suppose you're copying half the memory to the other half of
> memory. Let's suppose it takes a hundred extra instructions every 2GB to
> check that nobody else wants the CPU and dive back into the memcpy code.
> That's 800,000 additional instructions. Which even on a SPARC CPU is
> going to execute in less than 0.001 second. CPU memory bandwidth is
> on the order of 100GB/s, so the overall memcpy is going to take about
> 160 seconds.
Sure, the computational overhead is minimal, but still adding and
maintaining extra code to break-up a single memcpy() has its cost. For
example: as far I as can tell x86 and powerpc memcpy()s do not have this
limit, which means that an author of a driver would have to explicitly
divide memcpy()s into 2G chunks only to work on SPARC (and know about
this limit too!). If there is a driver that has a memory proportional
data structure it is possible it will panic the kernel once such driver
is attached on a larger memory machine.
Another example is memblock allocator that is currently unconditionally
calls memset() to zero all the allocated memory without breaking it up
into pieces, and when other CPUs are not yet available to split the work
to speed it up.
So, if a large chunk of memory is allocated via memblock() allocator,
(as one example when booted with kernel parameter: "hashdist=0") we will
have memset() called for 8G and 4G pieces of memory on machine with 7T
of memory, and that will cause panic if we will add this bound limit to
memset as well.
Thank you,
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-02-28 19:34 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-02-28 14:55 [PATCH v1 0/3] Zeroing hash tables in allocator Pavel Tatashin
2017-02-28 14:55 ` [PATCH v1 1/3] sparc64: NG4 memset/memcpy 32 bits overflow Pavel Tatashin
2017-02-28 15:12 ` David Miller
2017-02-28 15:56 ` Pasha Tatashin
2017-02-28 18:59 ` Matthew Wilcox
2017-02-28 19:34 ` Pasha Tatashin [this message]
2017-02-28 19:58 ` Matthew Wilcox
2017-02-28 14:55 ` [PATCH v1 2/3] mm: Zeroing hash tables in allocator Pavel Tatashin
2017-02-28 14:55 ` [PATCH v1 3/3] mm: Updated callers to use HASH_ZERO flag Pavel 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=a3a3a887-c7be-eb31-b73f-e179162fde93@oracle.com \
--to=pasha.tatashin@oracle.com \
--cc=davem@davemloft.net \
--cc=linux-mm@kvack.org \
--cc=sparclinux@vger.kernel.org \
--cc=willy@infradead.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