Messages in this thread | | | Subject | Re: [PATCH 02/10] drm/ttm: separate PageHighMem() and PageHighMemZone() use case | From | Christian König <> | Date | Mon, 20 Apr 2020 10:42:13 +0200 |
| |
Am 20.04.20 um 09:59 schrieb js1304@gmail.com: > From: Joonsoo Kim <iamjoonsoo.kim@lge.com> > > Until now, PageHighMem() is used for two different cases. One is to check > if there is a direct mapping for this page or not. The other is to check > the zone of this page, that is, weather it is the highmem type zone or not. > > Now, we have separate functions, PageHighMem() and PageHighMemZone() for > each cases. Use appropriate one. > > Note that there are some rules to determine the proper macro. > > 1. If PageHighMem() is called for checking if the direct mapping exists > or not, use PageHighMem(). > 2. If PageHighMem() is used to predict the previous gfp_flags for > this page, use PageHighMemZone(). The zone of the page is related to > the gfp_flags. > 3. If purpose of calling PageHighMem() is to count highmem page and > to interact with the system by using this count, use PageHighMemZone(). > This counter is usually used to calculate the available memory for an > kernel allocation and pages on the highmem zone cannot be available > for an kernel allocation. > 4. Otherwise, use PageHighMemZone(). It's safe since it's implementation > is just copy of the previous PageHighMem() implementation and won't > be changed. > > I apply the rule #4 for this patch. > > Signed-off-by: Joonsoo Kim <iamjoonsoo.kim@lge.com>
Reviewed-by: Christian König <christian.koenig@amd.com> for the TTM changes, but I can't judge if the general approach makes sense or not.
Regards, Christian.
> --- > drivers/gpu/drm/ttm/ttm_memory.c | 4 ++-- > drivers/gpu/drm/ttm/ttm_page_alloc.c | 2 +- > drivers/gpu/drm/ttm/ttm_page_alloc_dma.c | 2 +- > drivers/gpu/drm/ttm/ttm_tt.c | 2 +- > 4 files changed, 5 insertions(+), 5 deletions(-) > > diff --git a/drivers/gpu/drm/ttm/ttm_memory.c b/drivers/gpu/drm/ttm/ttm_memory.c > index acd63b7..d071b71 100644 > --- a/drivers/gpu/drm/ttm/ttm_memory.c > +++ b/drivers/gpu/drm/ttm/ttm_memory.c > @@ -641,7 +641,7 @@ int ttm_mem_global_alloc_page(struct ttm_mem_global *glob, > */ > > #ifdef CONFIG_HIGHMEM > - if (PageHighMem(page) && glob->zone_highmem != NULL) > + if (PageHighMemZone(page) && glob->zone_highmem != NULL) > zone = glob->zone_highmem; > #else > if (glob->zone_dma32 && page_to_pfn(page) > 0x00100000UL) > @@ -656,7 +656,7 @@ void ttm_mem_global_free_page(struct ttm_mem_global *glob, struct page *page, > struct ttm_mem_zone *zone = NULL; > > #ifdef CONFIG_HIGHMEM > - if (PageHighMem(page) && glob->zone_highmem != NULL) > + if (PageHighMemZone(page) && glob->zone_highmem != NULL) > zone = glob->zone_highmem; > #else > if (glob->zone_dma32 && page_to_pfn(page) > 0x00100000UL) > diff --git a/drivers/gpu/drm/ttm/ttm_page_alloc.c b/drivers/gpu/drm/ttm/ttm_page_alloc.c > index b40a467..847fabe 100644 > --- a/drivers/gpu/drm/ttm/ttm_page_alloc.c > +++ b/drivers/gpu/drm/ttm/ttm_page_alloc.c > @@ -530,7 +530,7 @@ static int ttm_alloc_new_pages(struct list_head *pages, gfp_t gfp_flags, > /* gfp flags of highmem page should never be dma32 so we > * we should be fine in such case > */ > - if (PageHighMem(p)) > + if (PageHighMemZone(p)) > continue; > > #endif > diff --git a/drivers/gpu/drm/ttm/ttm_page_alloc_dma.c b/drivers/gpu/drm/ttm/ttm_page_alloc_dma.c > index faefaae..338b2a2 100644 > --- a/drivers/gpu/drm/ttm/ttm_page_alloc_dma.c > +++ b/drivers/gpu/drm/ttm/ttm_page_alloc_dma.c > @@ -747,7 +747,7 @@ static int ttm_dma_pool_alloc_new_pages(struct dma_pool *pool, > /* gfp flags of highmem page should never be dma32 so we > * we should be fine in such case > */ > - if (PageHighMem(p)) > + if (PageHighMemZone(p)) > continue; > #endif > > diff --git a/drivers/gpu/drm/ttm/ttm_tt.c b/drivers/gpu/drm/ttm/ttm_tt.c > index 2ec448e..6e094dd 100644 > --- a/drivers/gpu/drm/ttm/ttm_tt.c > +++ b/drivers/gpu/drm/ttm/ttm_tt.c > @@ -119,7 +119,7 @@ static int ttm_tt_set_page_caching(struct page *p, > { > int ret = 0; > > - if (PageHighMem(p)) > + if (PageHighMemZone(p)) > return 0; > > if (c_old != tt_cached) {
| |