mm: honor FOLL_GET flag in follow_hugetlb_page v2
Subsystems (2)
PATCH 1/1 mm: honor FOLL_GET flag in follow_hugetlb_page v2
From: Jerome Glisse <[email protected]>
Do not increase page count if FOLL_GET is not set. None of the current user can trigger the issue because none of the current user call __get_user_pages with both the pages array ptr non NULL and the FOLL_GET flags non set in other word all caller of __get_user_pages that don't set the FOLL_GET flags also call with pages == NULL.
v2: Do not use get_page_foll. Improved comment.
--- mm/hugetlb.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
mm/hugetlb.c +3 -1
@@ -2981,7 +2981,9 @@ long follow_hugetlb_page(struct mm_struct *mm, struct vm_area_struct *vma, same_page:if (pages) { pages[i] =mem_map_offset (page, pfn_offset); -get_page (pages[i]); +if (flags &FOLL_GET ) { +get_page (pages[i]); + } }if (vmas)
Signature · 7 lines
1.7.11.7 -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Quoted 8 lines · On Tue, May 7, 2013 at 6:58 PM, <[email protected]> wrote:
From: Jerome Glisse <[email protected]>
Do not increase page count if
FOLL_GETis not set. None of the current user can trigger the issue because none of the current user call__get_user_pageswith both the pages array ptr non NULL and theFOLL_GETflags non set in other word all caller of__get_user_pagesthat don't set theFOLL_GETflags also call with pages == NULL.
Because, __get_user_pages() doesn't allow pages==NULL and FOLL_GET is on.
long __get_user_pages(struct task_struct *tsk, struct mm_struct *mm, {
(snip)
VM_BUG_ON(!!pages != !!(gup_flags & FOLL_GET));
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Quoted 11 lines · KOSAKI Motohiro
Quoted 8 lines · On Tue, May 7, 2013 at 6:58 PM, <[email protected]> wrote:
From: Jerome Glisse <[email protected]>
Do not increase page count if
FOLL_GETis not set. None of the current user can trigger the issue because none of the current user call__get_user_pageswith both the pages array ptr non NULL and theFOLL_GETflags non set in other word all caller of__get_user_pagesthat don't set theFOLL_GETflags also call with pages == NULL.Because,
__get_user_pages()doesn't allow pages==NULL andFOLL_GETis on.
Yes but this allow pages != NULL and FOLL_GET not set and as i said there is no such user of that yet and this is exactly what i was trying to use.
Cheers,
Jerome
Quoted 5 lines
long __get_user_pages(struct
task_struct*tsk, structmm_struct*mm, {
(snip)VM_BUG_ON(!!pages != !!(gup_flags & FOLL_GET));
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Quoted 12 lines · Jerome Glisse
Quoted 10 lines · KOSAKI Motohiro
Quoted 8 lines · On Tue, May 7, 2013 at 6:58 PM, <[email protected]> wrote:
From: Jerome Glisse <[email protected]>
Do not increase page count if
FOLL_GETis not set. None of the current user can trigger the issue because none of the current user call__get_user_pageswith both the pages array ptr non NULL and theFOLL_GETflags non set in other word all caller of__get_user_pagesthat don't set theFOLL_GETflags also call with pages == NULL.
Quoted 5 lines
Quoted 1 line
Because,
__get_user_pages()doesn't allow pages==NULL andFOLL_GETis on.Yes but this allow pages != NULL and
FOLL_GETnot set and as i said there is no such user of that yet and this is exactly what i was trying to use.
Why? The following bug_on inhibit both case.
Quoted 1 line
Quoted 1 line
VM_BUG_ON(!!pages != !!(gup_flags & FOLL_GET));
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Quoted 13 lines · KOSAKI Motohiro
Quoted 12 lines · Jerome Glisse
Quoted 10 lines · KOSAKI Motohiro
Quoted 8 lines · On Tue, May 7, 2013 at 6:58 PM, <[email protected]> wrote:
From: Jerome Glisse <[email protected]>
Do not increase page count if
FOLL_GETis not set. None of the current user can trigger the issue because none of the current user call__get_user_pageswith both the pages array ptr non NULL and theFOLL_GETflags non set in other word all caller of__get_user_pagesthat don't set theFOLL_GETflags also call with pages == NULL.
Quoted 7 lines
Quoted 5 lines
Quoted 1 line
Because,
__get_user_pages()doesn't allow pages==NULL andFOLL_GETis on.Yes but this allow pages != NULL and
FOLL_GETnot set and as i said there is no such user of that yet and this is exactly what i was trying to use.Why? The following
bug_oninhibit both case.
Yes i get lost on the double negation, but still my patch is correct and i am not using gup but follow_hugetlb_page directly and i run into the issue. My patch does not change the behavior for current user, just fix assumption new user might have when not setting the FOLL_GET flags.
Quoted 1 line
Quoted 1 line
Quoted 1 line
VM_BUG_ON(!!pages != !!(gup_flags & FOLL_GET));
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Quoted 7 lines
Quoted 1 line
Why? The following
bug_oninhibit both case.Yes i get lost on the double negation, but still my patch is correct and i am not using gup but
follow_hugetlb_pagedirectly and i run into the issue. My patch does not change the behavior for current user, just fix assumption new user might have when not setting theFOLL_GETflags.
I have no idea. I haven't seen your new use case.
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>