From: Hugh Dickins <hughd@google.com>
To: Jerome Marchand <jmarchan@redhat.com>
Cc: Oleg Nesterov <oleg@redhat.com>,
linux-mm@kvack.org, linux-kernel@vger.kernel.org,
linux-s390@vger.kernel.org, linux-doc@vger.kernel.org,
Hugh Dickins <hughd@google.com>,
Arnaldo Carvalho de Melo <acme@kernel.org>,
Ingo Molnar <mingo@redhat.com>, Paul Mackerras <paulus@samba.org>,
Peter Zijlstra <a.p.zijlstra@chello.nl>,
linux390@de.ibm.com, Heiko Carstens <heiko.carstens@de.ibm.com>,
Martin Schwidefsky <schwidefsky@de.ibm.com>,
Randy Dunlap <rdunlap@infradead.org>
Subject: Re: [PATCH 3/5] mm, shmem: Add shmem_vma() helper
Date: Thu, 31 Jul 2014 22:03:52 -0700 (PDT) [thread overview]
Message-ID: <alpine.LSU.2.11.1407312202040.3912@eggly.anvils> (raw)
In-Reply-To: <1406036632-26552-4-git-send-email-jmarchan@redhat.com>
On Tue, 22 Jul 2014, Jerome Marchand wrote:
> Add a simple helper to check if a vm area belongs to shmem.
>
> Signed-off-by: Jerome Marchand <jmarchan@redhat.com>
> ---
> include/linux/mm.h | 6 ++++++
> mm/shmem.c | 8 ++++++++
> 2 files changed, 14 insertions(+)
>
> diff --git a/include/linux/mm.h b/include/linux/mm.h
> index 34099fa..04a58d1 100644
> --- a/include/linux/mm.h
> +++ b/include/linux/mm.h
> @@ -1074,11 +1074,17 @@ int shmem_zero_setup(struct vm_area_struct *);
>
> extern int shmem_locate(struct vm_area_struct *vma, pgoff_t pgoff, int *count);
> bool shmem_mapping(struct address_space *mapping);
> +bool shmem_vma(struct vm_area_struct *vma);
> +
> #else
> static inline bool shmem_mapping(struct address_space *mapping)
> {
> return false;
> }
> +static inline bool shmem_vma(struct vm_area_struct *vma)
> +{
> + return false;
> +}
> #endif
I would prefer include/linux/shmem_fs.h for this (and one of us clean
up where the declarations of shmem_zero_setup and shmem_mapping live).
But if 4/5 goes away, then there will only be one user of shmem_vma(),
so in that case better just declare it (using shmem_mapping()) there
in task_mmu.c in the smaps patch.
>
> extern int can_do_mlock(void);
> diff --git a/mm/shmem.c b/mm/shmem.c
> index 8aa4892..7d16227 100644
> --- a/mm/shmem.c
> +++ b/mm/shmem.c
> @@ -1483,6 +1483,14 @@ bool shmem_mapping(struct address_space *mapping)
> return mapping->backing_dev_info == &shmem_backing_dev_info;
> }
>
> +bool shmem_vma(struct vm_area_struct *vma)
> +{
> + return (vma->vm_file &&
> + vma->vm_file->f_dentry->d_inode->i_mapping->backing_dev_info
> + == &shmem_backing_dev_info);
> +
I agree with Oleg,
vma->vm_file && shmem_mapping(file_inode(vma->vm_file)->i_mapping);
would be better,
Hugh
--
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:[~2014-08-01 5:03 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-07-22 13:43 [PATCH RESEND 0/5] mm, shmem: Enhance per-process accounting of shared memory Jerome Marchand
2014-07-22 13:43 ` [PATCH 1/5] mm, shmem: Add shmem resident memory accounting Jerome Marchand
2014-08-01 5:01 ` Hugh Dickins
2014-08-01 14:36 ` Jerome Marchand
2014-07-22 13:43 ` [PATCH 2/5] mm, shmem: Add shmem_locate function Jerome Marchand
2014-08-01 5:01 ` Hugh Dickins
2014-07-22 13:43 ` [PATCH 3/5] mm, shmem: Add shmem_vma() helper Jerome Marchand
2014-07-24 19:53 ` Oleg Nesterov
2014-08-01 5:03 ` Hugh Dickins [this message]
2014-08-01 14:37 ` Jerome Marchand
2014-07-22 13:43 ` [PATCH 4/5] mm, shmem: Add shmem swap memory accounting Jerome Marchand
2014-08-01 5:05 ` Hugh Dickins
2014-08-01 14:44 ` Jerome Marchand
2014-07-22 13:43 ` [PATCH 5/5] mm, shmem: Show location of non-resident shmem pages in smaps Jerome Marchand
2014-08-01 5:06 ` Hugh Dickins
2014-08-01 15:23 ` Jerome Marchand
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=alpine.LSU.2.11.1407312202040.3912@eggly.anvils \
--to=hughd@google.com \
--cc=a.p.zijlstra@chello.nl \
--cc=acme@kernel.org \
--cc=heiko.carstens@de.ibm.com \
--cc=jmarchan@redhat.com \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=linux-s390@vger.kernel.org \
--cc=linux390@de.ibm.com \
--cc=mingo@redhat.com \
--cc=oleg@redhat.com \
--cc=paulus@samba.org \
--cc=rdunlap@infradead.org \
--cc=schwidefsky@de.ibm.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: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox