In prepration for next patch remove inline of vm_unmapped_area and move
code to mmap.c. There is no logical change.
Also remove unmapped_area[_topdown] out of mm.h, there is no code
calling to them.
Signed-off-by: Jaewon Kim <[email protected]>
---
include/linux/mm.h | 21 +--------------------
mm/mmap.c | 16 ++++++++++++++++
2 files changed, 17 insertions(+), 20 deletions(-)
diff --git a/include/linux/mm.h b/include/linux/mm.h
index 52269e56c514..1cb01f4a83c9 100644
--- a/include/linux/mm.h
+++ b/include/linux/mm.h
@@ -2364,26 +2364,7 @@ struct vm_unmapped_area_info {
unsigned long align_offset;
};
-extern unsigned long unmapped_area(struct vm_unmapped_area_info *info);
-extern unsigned long unmapped_area_topdown(struct vm_unmapped_area_info *info);
-
-/*
- * Search for an unmapped address range.
- *
- * We are looking for a range that:
- * - does not intersect with any VMA;
- * - is contained within the [low_limit, high_limit) interval;
- * - is at least the desired size.
- * - satisfies (begin_addr & align_mask) == (align_offset & align_mask)
- */
-static inline unsigned long
-vm_unmapped_area(struct vm_unmapped_area_info *info)
-{
- if (info->flags & VM_UNMAPPED_AREA_TOPDOWN)
- return unmapped_area_topdown(info);
- else
- return unmapped_area(info);
-}
+extern unsigned long vm_unmapped_area(struct vm_unmapped_area_info *info);
/* truncate.c */
extern void truncate_inode_pages(struct address_space *, loff_t);
diff --git a/mm/mmap.c b/mm/mmap.c
index d681a20eb4ea..eeaddb76286c 100644
--- a/mm/mmap.c
+++ b/mm/mmap.c
@@ -2050,6 +2050,22 @@ unsigned long unmapped_area_topdown(struct vm_unmapped_area_info *info)
return gap_end;
}
+/*
+ * Search for an unmapped address range.
+ *
+ * We are looking for a range that:
+ * - does not intersect with any VMA;
+ * - is contained within the [low_limit, high_limit) interval;
+ * - is at least the desired size.
+ * - satisfies (begin_addr & align_mask) == (align_offset & align_mask)
+ */
+unsigned long vm_unmapped_area(struct vm_unmapped_area_info *info)
+{
+ if (info->flags & VM_UNMAPPED_AREA_TOPDOWN)
+ return unmapped_area_topdown(info);
+ else
+ return unmapped_area(info);
+}
#ifndef arch_get_mmap_end
#define arch_get_mmap_end(addr) (TASK_SIZE)
--
2.13.7
On Fri, 13 Mar 2020 10:14:19 +0900 Jaewon Kim <[email protected]> wrote:
> In prepration for next patch remove inline of vm_unmapped_area and move
> code to mmap.c. There is no logical change.
>
> Also remove unmapped_area[_topdown] out of mm.h, there is no code
> calling to them.
>
Patches seem reasonable.
> -extern unsigned long unmapped_area(struct vm_unmapped_area_info *info);
> -extern unsigned long unmapped_area_topdown(struct vm_unmapped_area_info *info);
I believe these can now be made static to mmap.c
On 2020년 03월 13일 12:02, Andrew Morton wrote:
> On Fri, 13 Mar 2020 10:14:19 +0900 Jaewon Kim <[email protected]> wrote:
>
>> In prepration for next patch remove inline of vm_unmapped_area and move
>> code to mmap.c. There is no logical change.
>>
>> Also remove unmapped_area[_topdown] out of mm.h, there is no code
>> calling to them.
>>
> Patches seem reasonable.
>
>> -extern unsigned long unmapped_area(struct vm_unmapped_area_info *info);
>> -extern unsigned long unmapped_area_topdown(struct vm_unmapped_area_info *info);
> I believe these can now be made static to mmap.c
Correct.
Let me wait for the 2/2 patch to be reviewed, and resubmit this 1/2 patch with having static if need.
Thank you for your comment.
>
>
>
>
On 3/13/20 2:14 AM, Jaewon Kim wrote:
> In prepration for next patch remove inline of vm_unmapped_area and move
> code to mmap.c. There is no logical change.
>
> Also remove unmapped_area[_topdown] out of mm.h, there is no code
> calling to them.
>
> Signed-off-by: Jaewon Kim <[email protected]>
Assuming the 'static' is added as Andrew pointed out,
Reviewed-by: Vlastimil Babka <[email protected]>
> ---
> include/linux/mm.h | 21 +--------------------
> mm/mmap.c | 16 ++++++++++++++++
> 2 files changed, 17 insertions(+), 20 deletions(-)
>
> diff --git a/include/linux/mm.h b/include/linux/mm.h
> index 52269e56c514..1cb01f4a83c9 100644
> --- a/include/linux/mm.h
> +++ b/include/linux/mm.h
> @@ -2364,26 +2364,7 @@ struct vm_unmapped_area_info {
> unsigned long align_offset;
> };
>
> -extern unsigned long unmapped_area(struct vm_unmapped_area_info *info);
> -extern unsigned long unmapped_area_topdown(struct vm_unmapped_area_info *info);
> -
> -/*
> - * Search for an unmapped address range.
> - *
> - * We are looking for a range that:
> - * - does not intersect with any VMA;
> - * - is contained within the [low_limit, high_limit) interval;
> - * - is at least the desired size.
> - * - satisfies (begin_addr & align_mask) == (align_offset & align_mask)
> - */
> -static inline unsigned long
> -vm_unmapped_area(struct vm_unmapped_area_info *info)
> -{
> - if (info->flags & VM_UNMAPPED_AREA_TOPDOWN)
> - return unmapped_area_topdown(info);
> - else
> - return unmapped_area(info);
> -}
> +extern unsigned long vm_unmapped_area(struct vm_unmapped_area_info *info);
>
> /* truncate.c */
> extern void truncate_inode_pages(struct address_space *, loff_t);
> diff --git a/mm/mmap.c b/mm/mmap.c
> index d681a20eb4ea..eeaddb76286c 100644
> --- a/mm/mmap.c
> +++ b/mm/mmap.c
> @@ -2050,6 +2050,22 @@ unsigned long unmapped_area_topdown(struct vm_unmapped_area_info *info)
> return gap_end;
> }
>
> +/*
> + * Search for an unmapped address range.
> + *
> + * We are looking for a range that:
> + * - does not intersect with any VMA;
> + * - is contained within the [low_limit, high_limit) interval;
> + * - is at least the desired size.
> + * - satisfies (begin_addr & align_mask) == (align_offset & align_mask)
> + */
> +unsigned long vm_unmapped_area(struct vm_unmapped_area_info *info)
> +{
> + if (info->flags & VM_UNMAPPED_AREA_TOPDOWN)
> + return unmapped_area_topdown(info);
> + else
> + return unmapped_area(info);
> +}
>
> #ifndef arch_get_mmap_end
> #define arch_get_mmap_end(addr) (TASK_SIZE)
>