lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20080612020235.29a81d7c.akpm@linux-foundation.org>
Date:	Thu, 12 Jun 2008 02:02:35 -0700
From:	Andrew Morton <akpm@...ux-foundation.org>
To:	righi.andrea@...il.com
Cc:	balbir@...ux.vnet.ibm.com, linux-mm@...ck.org,
	skumar@...ux.vnet.ibm.com, yamamoto@...inux.co.jp,
	menage@...gle.com, lizf@...fujitsu.com,
	linux-kernel@...r.kernel.org, xemul@...nvz.org,
	kamezawa.hiroyu@...fujitsu.com
Subject: Re: [-mm][PATCH 2/4] Setup the memrlimit controller (v5)

On Thu, 12 Jun 2008 10:52:13 +0200 (MEST) Andrea Righi <righi.andrea@...il.com> wrote:

> Balbir Singh wrote:
> > Andrew Morton wrote:
> >> #define PAGE_ALIGN(addr) ALIGN(addr, PAGE_SIZE)
> >>
> >> ?
> >>
> >> afaict ALIGN() tries to do the right thing, and if it doesn't, we
> >> should fix ALIGN().
> >>
> > 
> > That should do the right thing, provided there are no duplicate ALIGN defintions
> > elsewhere
> > 
> > kernel.h has
> > 
> > 
> > #define ALIGN(x,a)              __ALIGN_MASK(x,(typeof(x))(a)-1)
> > #define __ALIGN_MASK(x,mask)    (((x)+(mask))&~(mask))
> > 
> > Which seems like the correct thing, since we use typeof(x) for (a) - 1.
> 
> OK, I'm going to do some builds and tests on my i386 and x86_64 boxes
> with the following patch. I'm sure this will break something and I don't
> know if moving PAGE_ALIGN() out of asm-*/page.h is the right way.

Thanks.  Looks good from here.

>
> ...
>
> --- a/include/linux/mm.h
> +++ b/include/linux/mm.h
> @@ -9,6 +9,7 @@
>  #include <linux/list.h>
>  #include <linux/mmzone.h>
>  #include <linux/rbtree.h>
> +#include <linux/kernel.h>
>  #include <linux/prio_tree.h>
>  #include <linux/debug_locks.h>
>  #include <linux/mm_types.h>
> @@ -41,6 +42,9 @@ extern unsigned long mmap_min_addr;
>  
>  #define nth_page(page,n) pfn_to_page(page_to_pfn((page)) + (n))
>  
> +/* to align the pointer to the (next) page boundary */
> +#define PAGE_ALIGN(addr) ALIGN(addr, PAGE_SIZE)
> +
>  /*
>   * Linux kernel virtual memory manager primitives.
>   * The idea being to have a "virtual" mm in the same way

You don't really need the #include <linux/kernel.h> there.  As long as
all callsites which _use_ PAGE_ALIGN are including kernel.h via some
means (and they surely will be) then things will work OK.

But it won't hurt.  We're already picking up kernel.h there via
mmzone.h->spinlock.h and probably 100 other routes.  One more won't
make a lot of difference ;)

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ