[PATCH] mini-os: mm: don't have two large arrays of the same kind

Juergen Gross posted 1 patch 2 months, 3 weeks ago
Failed in applying to current master (apply log)
arch/x86/mm.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
[PATCH] mini-os: mm: don't have two large arrays of the same kind
Posted by Juergen Gross 2 months, 3 weeks ago
In the CONFIG_PARAVIRT case there are two identical static arrays of
more than 8kB size with function scope. As the two functions never
nest, a single array of file scope can replace the two existing
instances.

Signed-off-by: Juergen Gross <jgross@suse.com>
---
 arch/x86/mm.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/arch/x86/mm.c b/arch/x86/mm.c
index be1cf0cf..7ddf16e4 100644
--- a/arch/x86/mm.c
+++ b/arch/x86/mm.c
@@ -198,6 +198,10 @@ static void new_pt_frame(unsigned long *pt_pfn, unsigned long prev_l_mfn,
     *pt_pfn += 1;
 }
 
+#ifdef CONFIG_PARAVIRT
+static mmu_update_t mmu_updates[L1_PAGETABLE_ENTRIES + 1];
+#endif
+
 /*
  * Build the initial pagetable.
  */
@@ -209,7 +213,6 @@ static void build_pagetable(unsigned long *start_pfn, unsigned long *max_pfn)
     unsigned long pt_mfn = pfn_to_mfn(virt_to_pfn(pt_base));
     unsigned long offset;
 #ifdef CONFIG_PARAVIRT
-    static mmu_update_t mmu_updates[L1_PAGETABLE_ENTRIES + 1];
     int count = 0;
     int rc;
 #endif
@@ -323,7 +326,6 @@ static void set_readonly(void *text, void *etext)
     unsigned long offset;
     unsigned long page_size = PAGE_SIZE;
 #ifdef CONFIG_PARAVIRT
-    static mmu_update_t mmu_updates[L1_PAGETABLE_ENTRIES + 1];
     int count = 0;
     int rc;
 #endif
-- 
2.43.0
Re: [PATCH] mini-os: mm: don't have two large arrays of the same kind
Posted by Samuel Thibault 2 months, 3 weeks ago
Juergen Gross, le lun. 22 juil. 2024 17:08:43 +0200, a ecrit:
> In the CONFIG_PARAVIRT case there are two identical static arrays of
> more than 8kB size with function scope. As the two functions never
> nest, a single array of file scope can replace the two existing
> instances.
> 
> Signed-off-by: Juergen Gross <jgross@suse.com>

Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org>

> ---
>  arch/x86/mm.c | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/arch/x86/mm.c b/arch/x86/mm.c
> index be1cf0cf..7ddf16e4 100644
> --- a/arch/x86/mm.c
> +++ b/arch/x86/mm.c
> @@ -198,6 +198,10 @@ static void new_pt_frame(unsigned long *pt_pfn, unsigned long prev_l_mfn,
>      *pt_pfn += 1;
>  }
>  
> +#ifdef CONFIG_PARAVIRT
> +static mmu_update_t mmu_updates[L1_PAGETABLE_ENTRIES + 1];
> +#endif
> +
>  /*
>   * Build the initial pagetable.
>   */
> @@ -209,7 +213,6 @@ static void build_pagetable(unsigned long *start_pfn, unsigned long *max_pfn)
>      unsigned long pt_mfn = pfn_to_mfn(virt_to_pfn(pt_base));
>      unsigned long offset;
>  #ifdef CONFIG_PARAVIRT
> -    static mmu_update_t mmu_updates[L1_PAGETABLE_ENTRIES + 1];
>      int count = 0;
>      int rc;
>  #endif
> @@ -323,7 +326,6 @@ static void set_readonly(void *text, void *etext)
>      unsigned long offset;
>      unsigned long page_size = PAGE_SIZE;
>  #ifdef CONFIG_PARAVIRT
> -    static mmu_update_t mmu_updates[L1_PAGETABLE_ENTRIES + 1];
>      int count = 0;
>      int rc;
>  #endif
> -- 
> 2.43.0
> 

-- 
Samuel
/*
 * [...] Note that 120 sec is defined in the protocol as the maximum
 * possible RTT.  I guess we'll have to use something other than TCP
 * to talk to the University of Mars.
 * PAWS allows us longer timeouts and large windows, so once implemented
 * ftp to mars will work nicely.
 */
(from /usr/src/linux/net/inet/tcp.c, concerning RTT [retransmission timeout])