* [PATCH 01/10] sparc/mm: Fix MAX_ORDER usage in tsb_grow()
[not found] <20230315113133.11326-1-kirill.shutemov@linux.intel.com>
@ 2023-03-15 11:31 ` Kirill A. Shutemov
2023-03-16 3:04 ` Mike Kravetz
` (2 more replies)
0 siblings, 3 replies; 5+ messages in thread
From: Kirill A. Shutemov @ 2023-03-15 11:31 UTC (permalink / raw)
To: Andrew Morton, Mel Gorman, Vlastimil Babka, David Hildenbrand
Cc: linux-mm, linux-arch, linux-kernel, Kirill A. Shutemov,
sparclinux, David Miller
MAX_ORDER is not inclusive: the maximum allocation order buddy allocator
can deliver is MAX_ORDER-1.
Fix MAX_ORDER usage in tsb_grow().
Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
Cc: sparclinux@vger.kernel.org
Cc: David Miller <davem@davemloft.net>
---
arch/sparc/mm/tsb.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/arch/sparc/mm/tsb.c b/arch/sparc/mm/tsb.c
index 912205787161..dba8dffe2113 100644
--- a/arch/sparc/mm/tsb.c
+++ b/arch/sparc/mm/tsb.c
@@ -402,8 +402,8 @@ void tsb_grow(struct mm_struct *mm, unsigned long tsb_index, unsigned long rss)
unsigned long new_rss_limit;
gfp_t gfp_flags;
- if (max_tsb_size > (PAGE_SIZE << MAX_ORDER))
- max_tsb_size = (PAGE_SIZE << MAX_ORDER);
+ if (max_tsb_size > (PAGE_SIZE << (MAX_ORDER - 1)))
+ max_tsb_size = (PAGE_SIZE << (MAX_ORDER - 1));
new_cache_index = 0;
for (new_size = 8192; new_size < max_tsb_size; new_size <<= 1UL) {
--
2.39.2
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH 01/10] sparc/mm: Fix MAX_ORDER usage in tsb_grow()
2023-03-15 11:31 ` [PATCH 01/10] sparc/mm: Fix MAX_ORDER usage in tsb_grow() Kirill A. Shutemov
@ 2023-03-16 3:04 ` Mike Kravetz
2023-03-17 8:46 ` Mike Rapoport
2023-03-17 8:35 ` Mike Rapoport
2023-03-21 7:48 ` Vlastimil Babka
2 siblings, 1 reply; 5+ messages in thread
From: Mike Kravetz @ 2023-03-16 3:04 UTC (permalink / raw)
To: Kirill A. Shutemov
Cc: Andrew Morton, Mel Gorman, Vlastimil Babka, David Hildenbrand,
linux-mm, linux-arch, linux-kernel, sparclinux, David Miller
On 03/15/23 14:31, Kirill A. Shutemov wrote:
> MAX_ORDER is not inclusive: the maximum allocation order buddy allocator
> can deliver is MAX_ORDER-1.
>
> Fix MAX_ORDER usage in tsb_grow().
>
> Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
> Cc: sparclinux@vger.kernel.org
> Cc: David Miller <davem@davemloft.net>
> ---
> arch/sparc/mm/tsb.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/arch/sparc/mm/tsb.c b/arch/sparc/mm/tsb.c
> index 912205787161..dba8dffe2113 100644
> --- a/arch/sparc/mm/tsb.c
> +++ b/arch/sparc/mm/tsb.c
> @@ -402,8 +402,8 @@ void tsb_grow(struct mm_struct *mm, unsigned long tsb_index, unsigned long rss)
> unsigned long new_rss_limit;
> gfp_t gfp_flags;
>
> - if (max_tsb_size > (PAGE_SIZE << MAX_ORDER))
> - max_tsb_size = (PAGE_SIZE << MAX_ORDER);
> + if (max_tsb_size > (PAGE_SIZE << (MAX_ORDER - 1)))
> + max_tsb_size = (PAGE_SIZE << (MAX_ORDER - 1));
>
> new_cache_index = 0;
> for (new_size = 8192; new_size < max_tsb_size; new_size <<= 1UL) {
>
Fortunately, I think this only comes into play if MAX_ORDER <= 7.
Reviewed-by: Mike Kravetz <mike.kravetz@oracle.com>
--
Mike Kravetz
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 01/10] sparc/mm: Fix MAX_ORDER usage in tsb_grow()
2023-03-15 11:31 ` [PATCH 01/10] sparc/mm: Fix MAX_ORDER usage in tsb_grow() Kirill A. Shutemov
2023-03-16 3:04 ` Mike Kravetz
@ 2023-03-17 8:35 ` Mike Rapoport
2023-03-21 7:48 ` Vlastimil Babka
2 siblings, 0 replies; 5+ messages in thread
From: Mike Rapoport @ 2023-03-17 8:35 UTC (permalink / raw)
To: Kirill A. Shutemov
Cc: Andrew Morton, Mel Gorman, Vlastimil Babka, David Hildenbrand,
linux-mm, linux-arch, linux-kernel, sparclinux, David Miller
On Wed, Mar 15, 2023 at 02:31:24PM +0300, Kirill A. Shutemov wrote:
> MAX_ORDER is not inclusive: the maximum allocation order buddy allocator
> can deliver is MAX_ORDER-1.
>
> Fix MAX_ORDER usage in tsb_grow().
>
> Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
> Cc: sparclinux@vger.kernel.org
> Cc: David Miller <davem@davemloft.net>
Acked-by: Mike Rapoport (IBM) <rppt@kernel.org>
> ---
> arch/sparc/mm/tsb.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/arch/sparc/mm/tsb.c b/arch/sparc/mm/tsb.c
> index 912205787161..dba8dffe2113 100644
> --- a/arch/sparc/mm/tsb.c
> +++ b/arch/sparc/mm/tsb.c
> @@ -402,8 +402,8 @@ void tsb_grow(struct mm_struct *mm, unsigned long tsb_index, unsigned long rss)
> unsigned long new_rss_limit;
> gfp_t gfp_flags;
>
> - if (max_tsb_size > (PAGE_SIZE << MAX_ORDER))
> - max_tsb_size = (PAGE_SIZE << MAX_ORDER);
> + if (max_tsb_size > (PAGE_SIZE << (MAX_ORDER - 1)))
> + max_tsb_size = (PAGE_SIZE << (MAX_ORDER - 1));
>
> new_cache_index = 0;
> for (new_size = 8192; new_size < max_tsb_size; new_size <<= 1UL) {
> --
> 2.39.2
>
--
Sincerely yours,
Mike.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 01/10] sparc/mm: Fix MAX_ORDER usage in tsb_grow()
2023-03-16 3:04 ` Mike Kravetz
@ 2023-03-17 8:46 ` Mike Rapoport
0 siblings, 0 replies; 5+ messages in thread
From: Mike Rapoport @ 2023-03-17 8:46 UTC (permalink / raw)
To: Mike Kravetz
Cc: Kirill A. Shutemov, Andrew Morton, Mel Gorman, Vlastimil Babka,
David Hildenbrand, linux-mm, linux-arch, linux-kernel,
sparclinux, David Miller
On Wed, Mar 15, 2023 at 08:04:37PM -0700, Mike Kravetz wrote:
> On 03/15/23 14:31, Kirill A. Shutemov wrote:
> > MAX_ORDER is not inclusive: the maximum allocation order buddy allocator
> > can deliver is MAX_ORDER-1.
> >
> > Fix MAX_ORDER usage in tsb_grow().
> >
> > Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
> > Cc: sparclinux@vger.kernel.org
> > Cc: David Miller <davem@davemloft.net>
> > ---
> > arch/sparc/mm/tsb.c | 4 ++--
> > 1 file changed, 2 insertions(+), 2 deletions(-)
> >
> > diff --git a/arch/sparc/mm/tsb.c b/arch/sparc/mm/tsb.c
> > index 912205787161..dba8dffe2113 100644
> > --- a/arch/sparc/mm/tsb.c
> > +++ b/arch/sparc/mm/tsb.c
> > @@ -402,8 +402,8 @@ void tsb_grow(struct mm_struct *mm, unsigned long tsb_index, unsigned long rss)
> > unsigned long new_rss_limit;
> > gfp_t gfp_flags;
> >
> > - if (max_tsb_size > (PAGE_SIZE << MAX_ORDER))
> > - max_tsb_size = (PAGE_SIZE << MAX_ORDER);
> > + if (max_tsb_size > (PAGE_SIZE << (MAX_ORDER - 1)))
> > + max_tsb_size = (PAGE_SIZE << (MAX_ORDER - 1));
> >
> > new_cache_index = 0;
> > for (new_size = 8192; new_size < max_tsb_size; new_size <<= 1UL) {
> >
>
> Fortunately, I think this only comes into play if MAX_ORDER <= 7.
I think it's unlikely that such low ARCH_FORCE_MAX_ORDER is ever used.
Judging by c88c545bf320 ("sparc64: Add FORCE_MAX_ZONEORDER and default to
13") log the option to override MAX_ORDER was added to "request large (32M)
contiguous memory during boot for creating IOTSB backing store", so it was
about to increase MAX_ORDER.
Generally, we may restrict sparc::ARCH_FORCE_MAX_ORDER to be above 7 and
drop this check entirely
> Reviewed-by: Mike Kravetz <mike.kravetz@oracle.com>
> --
> Mike Kravetz
>
--
Sincerely yours,
Mike.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 01/10] sparc/mm: Fix MAX_ORDER usage in tsb_grow()
2023-03-15 11:31 ` [PATCH 01/10] sparc/mm: Fix MAX_ORDER usage in tsb_grow() Kirill A. Shutemov
2023-03-16 3:04 ` Mike Kravetz
2023-03-17 8:35 ` Mike Rapoport
@ 2023-03-21 7:48 ` Vlastimil Babka
2 siblings, 0 replies; 5+ messages in thread
From: Vlastimil Babka @ 2023-03-21 7:48 UTC (permalink / raw)
To: Kirill A. Shutemov, Andrew Morton, Mel Gorman, David Hildenbrand
Cc: linux-mm, linux-arch, linux-kernel, sparclinux, David Miller
On 3/15/23 12:31, Kirill A. Shutemov wrote:
> MAX_ORDER is not inclusive: the maximum allocation order buddy allocator
> can deliver is MAX_ORDER-1.
>
> Fix MAX_ORDER usage in tsb_grow().
>
> Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
Acked-by: Vlastimil Babka <vbabka@suse.cz>
> Cc: sparclinux@vger.kernel.org
> Cc: David Miller <davem@davemloft.net>
> ---
> arch/sparc/mm/tsb.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/arch/sparc/mm/tsb.c b/arch/sparc/mm/tsb.c
> index 912205787161..dba8dffe2113 100644
> --- a/arch/sparc/mm/tsb.c
> +++ b/arch/sparc/mm/tsb.c
> @@ -402,8 +402,8 @@ void tsb_grow(struct mm_struct *mm, unsigned long tsb_index, unsigned long rss)
> unsigned long new_rss_limit;
> gfp_t gfp_flags;
>
> - if (max_tsb_size > (PAGE_SIZE << MAX_ORDER))
> - max_tsb_size = (PAGE_SIZE << MAX_ORDER);
> + if (max_tsb_size > (PAGE_SIZE << (MAX_ORDER - 1)))
> + max_tsb_size = (PAGE_SIZE << (MAX_ORDER - 1));
>
> new_cache_index = 0;
> for (new_size = 8192; new_size < max_tsb_size; new_size <<= 1UL) {
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2023-03-21 7:48 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <20230315113133.11326-1-kirill.shutemov@linux.intel.com>
2023-03-15 11:31 ` [PATCH 01/10] sparc/mm: Fix MAX_ORDER usage in tsb_grow() Kirill A. Shutemov
2023-03-16 3:04 ` Mike Kravetz
2023-03-17 8:46 ` Mike Rapoport
2023-03-17 8:35 ` Mike Rapoport
2023-03-21 7:48 ` Vlastimil Babka
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).