From: Daniel Jordan <daniel.m.jordan@oracle.com> To: linux-mm@kvack.org, linux-kernel@vger.kernel.org Cc: aaron.lu@intel.com, akpm@linux-foundation.org, dave.hansen@linux.intel.com, mgorman@techsingularity.net, mhocko@kernel.org, mike.kravetz@oracle.com, pasha.tatashin@oracle.com, steven.sistare@oracle.com, tim.c.chen@intel.com Subject: [RFC PATCH v3 4/7] mm: enlarge type of offset argument in mem_map_offset and mem_map_next Date: Tue, 5 Dec 2017 14:52:17 -0500 [thread overview] Message-ID: <20171205195220.28208-5-daniel.m.jordan@oracle.com> (raw) In-Reply-To: <20171205195220.28208-1-daniel.m.jordan@oracle.com> Changes the type of 'offset' from int to unsigned long in both mem_map_offset and mem_map_next. This facilitates ktask's use of mem_map_next with its unsigned long types to avoid silent truncation when these unsigned longs are passed as ints. It also fixes the preexisting truncation of 'offset' from unsigned long to int by the sole caller of mem_map_offset, follow_hugetlb_page. Signed-off-by: Daniel Jordan <daniel.m.jordan@oracle.com> Reviewed-by: Steve Sistare <steven.sistare@oracle.com> Cc: Aaron Lu <aaron.lu@intel.com> Cc: Andrew Morton <akpm@linux-foundation.org> Cc: Dave Hansen <dave.hansen@linux.intel.com> Cc: Mel Gorman <mgorman@techsingularity.net> Cc: Michal Hocko <mhocko@kernel.org> Cc: Mike Kravetz <mike.kravetz@oracle.com> Cc: Pavel Tatashin <pasha.tatashin@oracle.com> Cc: Tim Chen <tim.c.chen@intel.com> --- mm/internal.h | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/mm/internal.h b/mm/internal.h index e6bd35182dae..cee1325fa682 100644 --- a/mm/internal.h +++ b/mm/internal.h @@ -366,7 +366,8 @@ static inline void mlock_migrate_page(struct page *new, struct page *old) { } * the maximally aligned gigantic page 'base'. Handle any discontiguity * in the mem_map at MAX_ORDER_NR_PAGES boundaries. */ -static inline struct page *mem_map_offset(struct page *base, int offset) +static inline struct page *mem_map_offset(struct page *base, + unsigned long offset) { if (unlikely(offset >= MAX_ORDER_NR_PAGES)) return nth_page(base, offset); @@ -377,8 +378,8 @@ static inline struct page *mem_map_offset(struct page *base, int offset) * Iterator over all subpages within the maximally aligned gigantic * page 'base'. Handle any discontiguity in the mem_map. */ -static inline struct page *mem_map_next(struct page *iter, - struct page *base, int offset) +static inline struct page *mem_map_next(struct page *iter, struct page *base, + unsigned long offset) { if (unlikely((offset & (MAX_ORDER_NR_PAGES - 1)) == 0)) { unsigned long pfn = page_to_pfn(base) + offset; -- 2.15.0
WARNING: multiple messages have this Message-ID (diff)
From: Daniel Jordan <daniel.m.jordan@oracle.com> To: linux-mm@kvack.org, linux-kernel@vger.kernel.org Cc: aaron.lu@intel.com, akpm@linux-foundation.org, dave.hansen@linux.intel.com, mgorman@techsingularity.net, mhocko@kernel.org, mike.kravetz@oracle.com, pasha.tatashin@oracle.com, steven.sistare@oracle.com, tim.c.chen@intel.com Subject: [RFC PATCH v3 4/7] mm: enlarge type of offset argument in mem_map_offset and mem_map_next Date: Tue, 5 Dec 2017 14:52:17 -0500 [thread overview] Message-ID: <20171205195220.28208-5-daniel.m.jordan@oracle.com> (raw) In-Reply-To: <20171205195220.28208-1-daniel.m.jordan@oracle.com> Changes the type of 'offset' from int to unsigned long in both mem_map_offset and mem_map_next. This facilitates ktask's use of mem_map_next with its unsigned long types to avoid silent truncation when these unsigned longs are passed as ints. It also fixes the preexisting truncation of 'offset' from unsigned long to int by the sole caller of mem_map_offset, follow_hugetlb_page. Signed-off-by: Daniel Jordan <daniel.m.jordan@oracle.com> Reviewed-by: Steve Sistare <steven.sistare@oracle.com> Cc: Aaron Lu <aaron.lu@intel.com> Cc: Andrew Morton <akpm@linux-foundation.org> Cc: Dave Hansen <dave.hansen@linux.intel.com> Cc: Mel Gorman <mgorman@techsingularity.net> Cc: Michal Hocko <mhocko@kernel.org> Cc: Mike Kravetz <mike.kravetz@oracle.com> Cc: Pavel Tatashin <pasha.tatashin@oracle.com> Cc: Tim Chen <tim.c.chen@intel.com> --- mm/internal.h | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/mm/internal.h b/mm/internal.h index e6bd35182dae..cee1325fa682 100644 --- a/mm/internal.h +++ b/mm/internal.h @@ -366,7 +366,8 @@ static inline void mlock_migrate_page(struct page *new, struct page *old) { } * the maximally aligned gigantic page 'base'. Handle any discontiguity * in the mem_map at MAX_ORDER_NR_PAGES boundaries. */ -static inline struct page *mem_map_offset(struct page *base, int offset) +static inline struct page *mem_map_offset(struct page *base, + unsigned long offset) { if (unlikely(offset >= MAX_ORDER_NR_PAGES)) return nth_page(base, offset); @@ -377,8 +378,8 @@ static inline struct page *mem_map_offset(struct page *base, int offset) * Iterator over all subpages within the maximally aligned gigantic * page 'base'. Handle any discontiguity in the mem_map. */ -static inline struct page *mem_map_next(struct page *iter, - struct page *base, int offset) +static inline struct page *mem_map_next(struct page *iter, struct page *base, + unsigned long offset) { if (unlikely((offset & (MAX_ORDER_NR_PAGES - 1)) == 0)) { unsigned long pfn = page_to_pfn(base) + offset; -- 2.15.0 -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@kvack.org. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
next prev parent reply other threads:[~2017-12-05 19:49 UTC|newest] Thread overview: 34+ messages / expand[flat|nested] mbox.gz Atom feed top 2017-12-05 19:52 [RFC PATCH v3 0/7] ktask: multithread CPU-intensive kernel work Daniel Jordan 2017-12-05 19:52 ` Daniel Jordan 2017-12-05 19:52 ` [RFC PATCH v3 1/7] ktask: add documentation Daniel Jordan 2017-12-05 19:52 ` Daniel Jordan 2017-12-05 20:59 ` Daniel Jordan 2017-12-05 20:59 ` Daniel Jordan 2017-12-06 14:35 ` Michal Hocko 2017-12-06 14:35 ` Michal Hocko 2017-12-06 20:32 ` Daniel Jordan 2017-12-06 20:32 ` Daniel Jordan 2017-12-08 12:43 ` Michal Hocko 2017-12-08 12:43 ` Michal Hocko 2017-12-08 13:46 ` Daniel Jordan 2017-12-08 13:46 ` Daniel Jordan 2017-12-05 19:52 ` [RFC PATCH v3 2/7] ktask: multithread CPU-intensive kernel work Daniel Jordan 2017-12-05 19:52 ` Daniel Jordan 2017-12-05 22:21 ` Andrew Morton 2017-12-05 22:21 ` Andrew Morton 2017-12-06 14:21 ` Daniel Jordan 2017-12-06 14:21 ` Daniel Jordan 2017-12-05 19:52 ` [RFC PATCH v3 3/7] ktask: add /proc/sys/debug/ktask_max_threads Daniel Jordan 2017-12-05 19:52 ` Daniel Jordan 2017-12-05 19:52 ` Daniel Jordan [this message] 2017-12-05 19:52 ` [RFC PATCH v3 4/7] mm: enlarge type of offset argument in mem_map_offset and mem_map_next Daniel Jordan 2017-12-05 19:52 ` [RFC PATCH v3 5/7] mm: parallelize clear_gigantic_page Daniel Jordan 2017-12-05 19:52 ` Daniel Jordan 2017-12-05 19:52 ` [RFC PATCH v3 6/7] hugetlbfs: parallelize hugetlbfs_fallocate with ktask Daniel Jordan 2017-12-05 19:52 ` Daniel Jordan 2017-12-05 19:52 ` [RFC PATCH v3 7/7] mm: parallelize deferred struct page initialization within each node Daniel Jordan 2017-12-05 19:52 ` Daniel Jordan 2017-12-05 22:23 ` [RFC PATCH v3 0/7] ktask: multithread CPU-intensive kernel work Andrew Morton 2017-12-05 22:23 ` Andrew Morton 2017-12-06 14:21 ` Daniel Jordan 2017-12-06 14:21 ` Daniel Jordan
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20171205195220.28208-5-daniel.m.jordan@oracle.com \ --to=daniel.m.jordan@oracle.com \ --cc=aaron.lu@intel.com \ --cc=akpm@linux-foundation.org \ --cc=dave.hansen@linux.intel.com \ --cc=linux-kernel@vger.kernel.org \ --cc=linux-mm@kvack.org \ --cc=mgorman@techsingularity.net \ --cc=mhocko@kernel.org \ --cc=mike.kravetz@oracle.com \ --cc=pasha.tatashin@oracle.com \ --cc=steven.sistare@oracle.com \ --cc=tim.c.chen@intel.com \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.