linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mm: Simplify code by SECTION_ALIGN_UP() and SECTION_ALIGN_DOWN() macro usage
@ 2011-06-09 18:20 Daniel Kiper
  2011-06-09 19:54 ` David Rientjes
  0 siblings, 1 reply; 2+ messages in thread
From: Daniel Kiper @ 2011-06-09 18:20 UTC (permalink / raw)
  To: rientjes, akpm, linux-kernel, linux-mm

git commit a539f3533b78e39a22723d6d3e1e11b6c14454d9 (mm: add SECTION_ALIGN_UP()
and SECTION_ALIGN_DOWN() macro) introduced SECTION_ALIGN_UP() and SECTION_ALIGN_DOWN()
macro. Use those macros to increase code readability.

This patch applies to Linus' git tree, v3.0-rc2 tag.

Signed-off-by: Daniel Kiper <dkiper@net-space.pl>
---
 mm/page_cgroup.c |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/mm/page_cgroup.c b/mm/page_cgroup.c
index 74ccff6..d818525 100644
--- a/mm/page_cgroup.c
+++ b/mm/page_cgroup.c
@@ -222,8 +222,8 @@ int __meminit online_page_cgroup(unsigned long start_pfn,
 	unsigned long start, end, pfn;
 	int fail = 0;
 
-	start = start_pfn & ~(PAGES_PER_SECTION - 1);
-	end = ALIGN(start_pfn + nr_pages, PAGES_PER_SECTION);
+	start = SECTION_ALIGN_DOWN(start_pfn);
+	end = SECTION_ALIGN_UP(start_pfn + nr_pages);
 
 	for (pfn = start; !fail && pfn < end; pfn += PAGES_PER_SECTION) {
 		if (!pfn_present(pfn))
@@ -245,8 +245,8 @@ int __meminit offline_page_cgroup(unsigned long start_pfn,
 {
 	unsigned long start, end, pfn;
 
-	start = start_pfn & ~(PAGES_PER_SECTION - 1);
-	end = ALIGN(start_pfn + nr_pages, PAGES_PER_SECTION);
+	start = SECTION_ALIGN_DOWN(start_pfn);
+	end = SECTION_ALIGN_UP(start_pfn + nr_pages);
 
 	for (pfn = start; pfn < end; pfn += PAGES_PER_SECTION)
 		__free_page_cgroup(pfn);
-- 
1.5.6.5

--
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/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] mm: Simplify code by SECTION_ALIGN_UP() and SECTION_ALIGN_DOWN() macro usage
  2011-06-09 18:20 [PATCH] mm: Simplify code by SECTION_ALIGN_UP() and SECTION_ALIGN_DOWN() macro usage Daniel Kiper
@ 2011-06-09 19:54 ` David Rientjes
  0 siblings, 0 replies; 2+ messages in thread
From: David Rientjes @ 2011-06-09 19:54 UTC (permalink / raw)
  To: Daniel Kiper; +Cc: akpm, linux-kernel, linux-mm

On Thu, 9 Jun 2011, Daniel Kiper wrote:

> git commit a539f3533b78e39a22723d6d3e1e11b6c14454d9 (mm: add SECTION_ALIGN_UP()
> and SECTION_ALIGN_DOWN() macro) introduced SECTION_ALIGN_UP() and SECTION_ALIGN_DOWN()
> macro. Use those macros to increase code readability.
> 
> This patch applies to Linus' git tree, v3.0-rc2 tag.
> 

 [ This patch would go through the -mm tree so it should always be based 
   on the latest git tree, no need to mention it.  Alternatively, if it 
   was based on something in -mm that isn't in the latest git yet, then
   you only need to append the "-mm" tag to the subject line:
   "[patch -mm]". ]

> Signed-off-by: Daniel Kiper <dkiper@net-space.pl>

Acked-by: David Rientjes <rientjes@google.com>

--
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/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2011-06-09 19:54 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-06-09 18:20 [PATCH] mm: Simplify code by SECTION_ALIGN_UP() and SECTION_ALIGN_DOWN() macro usage Daniel Kiper
2011-06-09 19:54 ` David Rientjes

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox