linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Barry Song <21cnbao@gmail.com>
To: SeongJae Park <sj@kernel.org>
Cc: akpm@linux-foundation.org, linux-mm@kvack.org,
	 linux-kernel@vger.kernel.org, Barry Song <v-songbaohua@oppo.com>,
	 David Hildenbrand <david@redhat.com>,
	Lance Yang <ioworker0@gmail.com>,
	 Ryan Roberts <ryan.roberts@arm.com>,
	Yin Fengwei <fengwei.yin@intel.com>
Subject: Re: [PATCH v2] mm: make folio_pte_batch available outside of mm/memory.c
Date: Wed, 28 Feb 2024 13:10:06 +1300	[thread overview]
Message-ID: <CAGsJ_4wWzG-37D82vqP_zt+Fcbz+URVe5oXLBc4M5wbN8A_gpQ@mail.gmail.com> (raw)
In-Reply-To: <20240227215426.153162-1-sj@kernel.org>

On Wed, Feb 28, 2024 at 10:54 AM SeongJae Park <sj@kernel.org> wrote:
>
> On Tue, 27 Feb 2024 23:42:01 +1300 Barry Song <21cnbao@gmail.com> wrote:
>
> > From: Barry Song <v-songbaohua@oppo.com>
> >
> > madvise, mprotect and some others might need folio_pte_batch to check if
> > a range of PTEs are completely mapped to a large folio with contiguous
> > physical addresses. Let's make it available in mm/internal.h.
>
> Hi Barry,
>
>
> I found this patch makes some of my build test that not setting CONFIG_MMU
> fails with multiple errors including below:
>
>     In file included from .../mm/nommu.c:43:
>     .../mm/internal.h: In function '__pte_batch_clear_ignored':
>     .../mm/internal.h:98:23: error: implicit declaration of function 'pte_mkclean'; did you mean 'page_mkclean'? [-Werror=implicit-function-declaration]
>        98 |                 pte = pte_mkclean(pte);
>           |                       ^~~~~~~~~~~
>           |                       page_mkclean
>
> Enabling CONFIG_MMU made the build success.  I haven't had a time to look into
> the code yet.  May I ask your opinion?

i guess it is because we have moved some func from memory.c to
headfile. and this headfile is included by lots of
files in mm.  memory.c, for itself, will only be compiled with enabled
CONFIG_MMU:
mmu-$(CONFIG_MMU)       := highmem.o memory.o mincore.o \
                           mlock.o mmap.o mmu_gather.o mprotect.o mremap.o \
                           msync.o page_vma_mapped.o pagewalk.o \
                           pgtable-generic.o rmap.o vmalloc.o

Does the below fix your build?

diff --git a/mm/internal.h b/mm/internal.h
index fa9e2f7db506..4e57680b74e1 100644
--- a/mm/internal.h
+++ b/mm/internal.h
@@ -83,6 +83,8 @@ static inline void *folio_raw_mapping(struct folio *folio)
        return (void *)(mapping & ~PAGE_MAPPING_FLAGS);
 }

+#ifdef CONFIG_MMU
+
 /* Flags for folio_pte_batch(). */
 typedef int __bitwise fpb_t;

@@ -172,6 +174,7 @@ static inline int folio_pte_batch(struct folio
*folio, unsigned long addr,

        return min(ptep - start_ptep, max_nr);
 }
+#endif /* CONFIG_MMU */

 void __acct_reclaim_writeback(pg_data_t *pgdat, struct folio *folio,
                                                int nr_throttled);


> Thanks,
> SJ

Thanks
Barry


  reply	other threads:[~2024-02-28  0:10 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-27 10:42 Barry Song
2024-02-27 10:48 ` Ryan Roberts
2024-02-27 15:08 ` David Hildenbrand
2024-02-27 21:54 ` SeongJae Park
2024-02-28  0:10   ` Barry Song [this message]
2024-02-28  0:15     ` SeongJae Park

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=CAGsJ_4wWzG-37D82vqP_zt+Fcbz+URVe5oXLBc4M5wbN8A_gpQ@mail.gmail.com \
    --to=21cnbao@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=david@redhat.com \
    --cc=fengwei.yin@intel.com \
    --cc=ioworker0@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=ryan.roberts@arm.com \
    --cc=sj@kernel.org \
    --cc=v-songbaohua@oppo.com \
    /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