LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCH] Define the shmem_inode_info flags directly
@ 2007-02-07 20:40 Adam Litke
  2007-02-07 23:27 ` Hugh Dickins
  0 siblings, 1 reply; 2+ messages in thread
From: Adam Litke @ 2007-02-07 20:40 UTC (permalink / raw)
  To: akpm; +Cc: linux-kernel, linux-mm, agl


Andrew: This is a pretty basic and obvious cleanup IMO.  How about a ride in
-mm?

Defining flags in terms of other flags is always confusing.  Give them literal
values instead of defining them in terms of VM_flags.  While we're at it, move
them to a header file in preparation for the introduction of a
SHMEM_HUGETLB flag.

Signed-off-by: Adam Litke <agl@us.ibm.com>
---

 include/linux/shmem_fs.h |    4 ++++
 mm/shmem.c               |    4 ----
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/include/linux/shmem_fs.h b/include/linux/shmem_fs.h
index f3c5189..3ea0b6e 100644
--- a/include/linux/shmem_fs.h
+++ b/include/linux/shmem_fs.h
@@ -8,6 +8,10 @@
 
 #define SHMEM_NR_DIRECT 16
 
+/* These info->flags are used to handle pagein/truncate races efficiently */
+#define SHMEM_PAGEIN	0x00000001
+#define SHMEM_TRUNCATE	0x00000002
+
 struct shmem_inode_info {
 	spinlock_t		lock;
 	unsigned long		flags;
diff --git a/mm/shmem.c b/mm/shmem.c
index 70da7a0..a9bdb0d 100644
--- a/mm/shmem.c
+++ b/mm/shmem.c
@@ -66,10 +66,6 @@
 
 #define VM_ACCT(size)    (PAGE_CACHE_ALIGN(size) >> PAGE_SHIFT)
 
-/* info->flags needs VM_flags to handle pagein/truncate races efficiently */
-#define SHMEM_PAGEIN	 VM_READ
-#define SHMEM_TRUNCATE	 VM_WRITE
-
 /* Definition to limit shmem_truncate's steps between cond_rescheds */
 #define LATENCY_LIMIT	 64
 

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

* Re: [PATCH] Define the shmem_inode_info flags directly
  2007-02-07 20:40 [PATCH] Define the shmem_inode_info flags directly Adam Litke
@ 2007-02-07 23:27 ` Hugh Dickins
  0 siblings, 0 replies; 2+ messages in thread
From: Hugh Dickins @ 2007-02-07 23:27 UTC (permalink / raw)
  To: Adam Litke; +Cc: akpm, linux-kernel, linux-mm

On Wed, 7 Feb 2007, Adam Litke wrote:
> 
> Andrew: This is a pretty basic and obvious cleanup IMO.  How about a ride in
> -mm?
> 
> Defining flags in terms of other flags is always confusing.  Give them literal
> values instead of defining them in terms of VM_flags.  While we're at it, move
> them to a header file in preparation for the introduction of a
> SHMEM_HUGETLB flag.

NAK.  Look further and you'll find at least VM_LOCKED and VM_ACCOUNT
also used straight in shmem info->flags: it's trying to ensure there
won't be a clash when applying VM_flags there.  So you've a choice of
three ways forward, I don't mind which: (a) leave it alone, (b) add
comments, (c) define a separate set of flags for SHMEM and convert
where necessary.  But NAK to this patch.

(Sorry, I'm way behind and haven't checked your earlier mails yet.)

Hugh

> 
> Signed-off-by: Adam Litke <agl@us.ibm.com>
> ---
> 
>  include/linux/shmem_fs.h |    4 ++++
>  mm/shmem.c               |    4 ----
>  2 files changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/include/linux/shmem_fs.h b/include/linux/shmem_fs.h
> index f3c5189..3ea0b6e 100644
> --- a/include/linux/shmem_fs.h
> +++ b/include/linux/shmem_fs.h
> @@ -8,6 +8,10 @@
>  
>  #define SHMEM_NR_DIRECT 16
>  
> +/* These info->flags are used to handle pagein/truncate races efficiently */
> +#define SHMEM_PAGEIN	0x00000001
> +#define SHMEM_TRUNCATE	0x00000002
> +
>  struct shmem_inode_info {
>  	spinlock_t		lock;
>  	unsigned long		flags;
> diff --git a/mm/shmem.c b/mm/shmem.c
> index 70da7a0..a9bdb0d 100644
> --- a/mm/shmem.c
> +++ b/mm/shmem.c
> @@ -66,10 +66,6 @@
>  
>  #define VM_ACCT(size)    (PAGE_CACHE_ALIGN(size) >> PAGE_SHIFT)
>  
> -/* info->flags needs VM_flags to handle pagein/truncate races efficiently */
> -#define SHMEM_PAGEIN	 VM_READ
> -#define SHMEM_TRUNCATE	 VM_WRITE
> -
>  /* Definition to limit shmem_truncate's steps between cond_rescheds */
>  #define LATENCY_LIMIT	 64

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

end of thread, other threads:[~2007-02-07 23:46 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-02-07 20:40 [PATCH] Define the shmem_inode_info flags directly Adam Litke
2007-02-07 23:27 ` Hugh Dickins

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).