Message ID | 20210622121551.3398730-6-willy@infradead.org (mailing list archive) |
---|---|
State | New |
Headers | show |
Series | Folio-enabling the page cache | expand |
On Tue, Jun 22, 2021 at 01:15:10PM +0100, Matthew Wilcox (Oracle) wrote: > As a default implementation, call arch_make_page_accessible n times. > If an architecture can do better, it can override this. > > Also move the default implementation of arch_make_page_accessible() > from gfp.h to mm.h. Can we wait with introducing arch hooks until we have an actual user lined up?
On Wed, Jun 23, 2021 at 10:00:37AM +0200, Christoph Hellwig wrote: > On Tue, Jun 22, 2021 at 01:15:10PM +0100, Matthew Wilcox (Oracle) wrote: > > As a default implementation, call arch_make_page_accessible n times. > > If an architecture can do better, it can override this. > > > > Also move the default implementation of arch_make_page_accessible() > > from gfp.h to mm.h. > > Can we wait with introducing arch hooks until we have an actual user > lined up? This one gets used in __folio_end_writeback() which is patch 24 in this series.
On Thu, Jun 24, 2021 at 04:57:29PM +0100, Matthew Wilcox wrote: > On Wed, Jun 23, 2021 at 10:00:37AM +0200, Christoph Hellwig wrote: > > On Tue, Jun 22, 2021 at 01:15:10PM +0100, Matthew Wilcox (Oracle) wrote: > > > As a default implementation, call arch_make_page_accessible n times. > > > If an architecture can do better, it can override this. > > > > > > Also move the default implementation of arch_make_page_accessible() > > > from gfp.h to mm.h. > > > > Can we wait with introducing arch hooks until we have an actual user > > lined up? > > This one gets used in __folio_end_writeback() which is patch 24 in this > series. With arch hook I mean the ifdef to allow the architeture to override the folio function. Same for the previous patch, btw.
On Mon, Jun 28, 2021 at 07:21:01AM +0100, Christoph Hellwig wrote: > On Thu, Jun 24, 2021 at 04:57:29PM +0100, Matthew Wilcox wrote: > > On Wed, Jun 23, 2021 at 10:00:37AM +0200, Christoph Hellwig wrote: > > > On Tue, Jun 22, 2021 at 01:15:10PM +0100, Matthew Wilcox (Oracle) wrote: > > > > As a default implementation, call arch_make_page_accessible n times. > > > > If an architecture can do better, it can override this. > > > > > > > > Also move the default implementation of arch_make_page_accessible() > > > > from gfp.h to mm.h. > > > > > > Can we wait with introducing arch hooks until we have an actual user > > > lined up? > > > > This one gets used in __folio_end_writeback() which is patch 24 in this > > series. > > With arch hook I mean the ifdef to allow the architeture to override > the folio function. Same for the previous patch, btw. Ah. Actually, I hope that all architectures override this. Ideally 'accessible' and 'dcache flush needed' would be per-folio flags, set only on the head page, but the different architectures are inconsistent about this. So I've gone with "safe and slow" for the default, and maybe when all architectures have decided that they'd rather be fast than safe, we can fix this up. As you know, I want to get rid of tail pages eventually, so I'm trying to enable other people to do parts of that work for me.
diff --git a/include/linux/gfp.h b/include/linux/gfp.h index 11da8af06704..a503d928e684 100644 --- a/include/linux/gfp.h +++ b/include/linux/gfp.h @@ -508,12 +508,6 @@ static inline void arch_free_page(struct page *page, int order) { } #ifndef HAVE_ARCH_ALLOC_PAGE static inline void arch_alloc_page(struct page *page, int order) { } #endif -#ifndef HAVE_ARCH_MAKE_PAGE_ACCESSIBLE -static inline int arch_make_page_accessible(struct page *page) -{ - return 0; -} -#endif struct page *__alloc_pages(gfp_t gfp, unsigned int order, int preferred_nid, nodemask_t *nodemask); diff --git a/include/linux/mm.h b/include/linux/mm.h index 2c7b6ae1d3fc..5609095ffcac 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -1719,6 +1719,27 @@ static inline size_t folio_size(struct folio *folio) return PAGE_SIZE << folio_order(folio); } +#ifndef HAVE_ARCH_MAKE_PAGE_ACCESSIBLE +static inline int arch_make_page_accessible(struct page *page) +{ + return 0; +} +#endif + +#ifndef HAVE_ARCH_MAKE_FOLIO_ACCESSIBLE +static inline int arch_make_folio_accessible(struct folio *folio) +{ + int ret, i; + for (i = 0; i < folio_nr_pages(folio); i++) { + ret = arch_make_page_accessible(folio_page(folio, i)); + if (ret) + break; + } + + return ret; +} +#endif + /* * Some inline functions in vmstat.h depend on page_zone() */
As a default implementation, call arch_make_page_accessible n times. If an architecture can do better, it can override this. Also move the default implementation of arch_make_page_accessible() from gfp.h to mm.h. Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org> --- include/linux/gfp.h | 6 ------ include/linux/mm.h | 21 +++++++++++++++++++++ 2 files changed, 21 insertions(+), 6 deletions(-)