Re: [PATCH 5/8] mm: simplify freeing of devmap managed pages

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> -static inline bool page_is_devmap_managed(struct page *page)
> +bool __put_devmap_managed_page(struct page *page);
> +static inline bool put_devmap_managed_page(struct page *page)
>   {
>   	if (!static_branch_unlikely(&devmap_managed_key))
>   		return false;
>   	if (!is_zone_device_page(page))
>   		return false;
> -	switch (page->pgmap->type) {
> -	case MEMORY_DEVICE_PRIVATE:
> -	case MEMORY_DEVICE_FS_DAX:
> -		return true;
> -	default:
> -		break;
> -	}

nit:- how some variant of following to makes all cases evident
without having to look into memremap.h for other enum values ?

         switch (page->pgmap->type) {
         case MEMORY_DEVICE_PRIVATE:
         case MEMORY_DEVICE_FS_DAX:
                 return __put_devmap_managed_page(page);
         case MEMORY_DEVICE_GENERIC:
         case MEMORY_DEVICE_PCI_P2PDMA:
                 return false;
         default:
                 WARN_ON_ONCE(1);
                 return false;
         }


> -	return false;
> +	if (page->pgmap->type != MEMORY_DEVICE_PRIVATE &&
> +	    page->pgmap->type != MEMORY_DEVICE_FS_DAX)
> +		return false;
> +	return __put_devmap_managed_page(page);

nit:- we are only returning true value from __put_devmap_managed_page()
in this patch. Perhaps make it __put_dev_map_managed_page()
return void and return true from above ?

or maybe someone can send a cleanup once this is merged.

>   }
>   

Irrespective of above comment(s), looks good.

Reviewed-by: Chaitanya Kulkarni <kch@xxxxxxxxxx>





[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux