Re: [PATCH 4/9] mm/rmap: make rmap_walk to get the rmap_walk_control argument

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

 



On Thu, Nov 28, 2013 at 04:48:41PM +0900, Joonsoo Kim wrote:
> In each rmap traverse case, there is some difference so that we need
> function pointers and arguments to them in order to handle these
> difference properly.
> 
> For this purpose, struct rmap_walk_control is introduced in this patch,
> and will be extended in following patch. Introducing and extending are
> separate, because it clarify changes.
> 
> Signed-off-by: Joonsoo Kim <iamjoonsoo.kim@xxxxxxx>

Reviewed-by: Naoya Horiguchi <n-horiguchi@xxxxxxxxxxxxx>

A few comment below ...

> diff --git a/include/linux/ksm.h b/include/linux/ksm.h
> index 45c9b6a..0eef8cb 100644
> --- a/include/linux/ksm.h
> +++ b/include/linux/ksm.h
> @@ -76,8 +76,7 @@ struct page *ksm_might_need_to_copy(struct page *page,
>  int page_referenced_ksm(struct page *page,
>  			struct mem_cgroup *memcg, unsigned long *vm_flags);
>  int try_to_unmap_ksm(struct page *page, enum ttu_flags flags);
> -int rmap_walk_ksm(struct page *page, int (*rmap_one)(struct page *,
> -		  struct vm_area_struct *, unsigned long, void *), void *arg);
> +int rmap_walk_ksm(struct page *page, struct rmap_walk_control *rwc);
>  void ksm_migrate_page(struct page *newpage, struct page *oldpage);
>  
>  #else  /* !CONFIG_KSM */
> @@ -120,8 +119,8 @@ static inline int try_to_unmap_ksm(struct page *page, enum ttu_flags flags)
>  	return 0;
>  }
>  
> -static inline int rmap_walk_ksm(struct page *page, int (*rmap_one)(struct page*,
> -		struct vm_area_struct *, unsigned long, void *), void *arg)
> +static inline int rmap_walk_ksm(struct page *page,
> +			struct rmap_walk_control *rwc)
>  {
>  	return 0;
>  }
> diff --git a/include/linux/rmap.h b/include/linux/rmap.h
> index 6dacb93..0f65686 100644
> --- a/include/linux/rmap.h
> +++ b/include/linux/rmap.h
> @@ -235,11 +235,16 @@ struct anon_vma *page_lock_anon_vma_read(struct page *page);
>  void page_unlock_anon_vma_read(struct anon_vma *anon_vma);
>  int page_mapped_in_vma(struct page *page, struct vm_area_struct *vma);
>  
> +struct rmap_walk_control {
> +	int (*main)(struct page *, struct vm_area_struct *,
> +					unsigned long, void *);

Maybe you can add parameters' names to make this prototype more readable.

> +	void *arg;	/* argument to main function */
> +};
> +
>  /*
>   * Called by migrate.c to remove migration ptes, but might be used more later.
>   */

This comment also needs update?

Thanks,
Naoya Horiguchi

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@xxxxxxxxx.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@xxxxxxxxx";> email@xxxxxxxxx </a>




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]