* [PATCH] nptl: Remove MULTI_PAGE_ALIASING [BZ #23554]
@ 2021-03-19 19:57 H.J. Lu
2021-03-19 20:02 ` Florian Weimer
0 siblings, 1 reply; 2+ messages in thread
From: H.J. Lu @ 2021-03-19 19:57 UTC (permalink / raw)
To: libc-alpha; +Cc: Carlos O'Donell, Florian Weimer
MULTI_PAGE_ALIASING was introduced to mitigate an aliasing issue on
Pentium 4. It is no longer needed for processors after Pentium 4.
---
nptl/allocatestack.c | 10 ----------
nptl/stack-aliasing.h | 23 -----------------------
sysdeps/i386/i686/stack-aliasing.h | 23 -----------------------
sysdeps/x86_64/stack-aliasing.h | 1 -
4 files changed, 57 deletions(-)
delete mode 100644 nptl/stack-aliasing.h
delete mode 100644 sysdeps/i386/i686/stack-aliasing.h
delete mode 100644 sysdeps/x86_64/stack-aliasing.h
diff --git a/nptl/allocatestack.c b/nptl/allocatestack.c
index 149b999603..00fddbd409 100644
--- a/nptl/allocatestack.c
+++ b/nptl/allocatestack.c
@@ -31,7 +31,6 @@
#include <lowlevellock.h>
#include <futex-internal.h>
#include <kernel-features.h>
-#include <stack-aliasing.h>
#ifndef NEED_SEPARATE_REGISTER_STACK
@@ -547,15 +546,6 @@ allocate_stack (const struct pthread_attr *attr, struct pthread **pdp,
pd = get_cached_stack (&size, &mem);
if (pd == NULL)
{
- /* To avoid aliasing effects on a larger scale than pages we
- adjust the allocated stack size if necessary. This way
- allocations directly following each other will not have
- aliasing problems. */
-#if MULTI_PAGE_ALIASING != 0
- if ((size % MULTI_PAGE_ALIASING) == 0)
- size += pagesize_m1 + 1;
-#endif
-
/* If a guard page is required, avoid committing memory by first
allocate with PROT_NONE and then reserve with required permission
excluding the guard page. */
diff --git a/nptl/stack-aliasing.h b/nptl/stack-aliasing.h
deleted file mode 100644
index bfdde53e53..0000000000
--- a/nptl/stack-aliasing.h
+++ /dev/null
@@ -1,23 +0,0 @@
-/* Define macros for stack address aliasing issues for NPTL. Stub version.
- Copyright (C) 2014-2021 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
-
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- The GNU C Library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, see
- <https://www.gnu.org/licenses/>. */
-
-/* This is a number of bytes that is an alignment that should be avoided
- when choosing the exact size of a new thread's stack. If the size
- chosen is aligned to this, an extra page will be added to render the
- size off-aligned. */
-#define MULTI_PAGE_ALIASING 0
diff --git a/sysdeps/i386/i686/stack-aliasing.h b/sysdeps/i386/i686/stack-aliasing.h
deleted file mode 100644
index d521dcdb75..0000000000
--- a/sysdeps/i386/i686/stack-aliasing.h
+++ /dev/null
@@ -1,23 +0,0 @@
-/* Define macros for stack address aliasing issues for NPTL. i686 version.
- Copyright (C) 2014-2021 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
-
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- The GNU C Library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, see
- <https://www.gnu.org/licenses/>. */
-
-/* What is useful is to avoid the 64k aliasing problem which reliably
- happens if all stacks use sizes which are a multiple of 64k. Tell
- the stack allocator to disturb this by allocation one more page if
- necessary. */
-#define MULTI_PAGE_ALIASING 65536
diff --git a/sysdeps/x86_64/stack-aliasing.h b/sysdeps/x86_64/stack-aliasing.h
deleted file mode 100644
index 2efdacb3b4..0000000000
--- a/sysdeps/x86_64/stack-aliasing.h
+++ /dev/null
@@ -1 +0,0 @@
-#include <sysdeps/i386/i686/stack-aliasing.h>
--
2.30.2
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] nptl: Remove MULTI_PAGE_ALIASING [BZ #23554]
2021-03-19 19:57 [PATCH] nptl: Remove MULTI_PAGE_ALIASING [BZ #23554] H.J. Lu
@ 2021-03-19 20:02 ` Florian Weimer
0 siblings, 0 replies; 2+ messages in thread
From: Florian Weimer @ 2021-03-19 20:02 UTC (permalink / raw)
To: H.J. Lu via Libc-alpha; +Cc: H.J. Lu, Florian Weimer
* H. J. Lu via Libc-alpha:
> MULTI_PAGE_ALIASING was introduced to mitigate an aliasing issue on
> Pentium 4. It is no longer needed for processors after Pentium 4.
Thanks, looks okay.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2021-03-19 20:02 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-19 19:57 [PATCH] nptl: Remove MULTI_PAGE_ALIASING [BZ #23554] H.J. Lu
2021-03-19 20:02 ` Florian Weimer
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 read-only IMAP folder(s) and NNTP newsgroup(s).