All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>
To: Johannes Weiner <hannes@cmpxchg.org>
Cc: "Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	Oleg Nesterov <oleg@redhat.com>,
	linux-mm@kvack.org, linux-kernel@vger.kernel.org,
	Michal Hocko <mhocko@suse.cz>
Subject: Re: [PATCH 5/5] mm, memcontrol: use vma_is_anonymous() to check for anon VMA
Date: Mon, 13 Jul 2015 16:20:56 +0300 (EEST)	[thread overview]
Message-ID: <20150713132056.D0CDAA4@black.fi.intel.com> (raw)
In-Reply-To: <20150713130812.GA8115@cmpxchg.org>

Johannes Weiner wrote:
> On Mon, Jul 13, 2015 at 01:54:12PM +0300, Kirill A. Shutemov wrote:
> > !vma->vm_file is not reliable to detect anon VMA, because not all
> > drivers bother set it. Let's use vma_is_anonymous() instead.
> > 
> > Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
> > Cc: Johannes Weiner <hannes@cmpxchg.org>
> > Cc: Michal Hocko <mhocko@suse.cz>
> > ---
> >  mm/memcontrol.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/mm/memcontrol.c b/mm/memcontrol.c
> > index acb93c554f6e..a624709f0dd7 100644
> > --- a/mm/memcontrol.c
> > +++ b/mm/memcontrol.c
> > @@ -4809,7 +4809,7 @@ static struct page *mc_handle_file_pte(struct vm_area_struct *vma,
> >  	struct address_space *mapping;
> >  	pgoff_t pgoff;
> >  
> > -	if (!vma->vm_file) /* anonymous vma */
> > +	if (vma_is_anonymous(vma)) /* anonymous vma */
> >  		return NULL;
> >  	if (!(mc.flags & MOVE_FILE))
> >  		return NULL;
> 
> The next line does vma->vm_file->f_mapping, so it had better be !NULL.
> 
> It's not about reliably detecting anonymous vs. file, it is about
> whether there is a mapping against which we can do find_get_page().

You're right. This patch is totally broken.

-- 
 Kirill

--
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>

WARNING: multiple messages have this Message-ID (diff)
From: "Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>
To: Johannes Weiner <hannes@cmpxchg.org>
Cc: "Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	Oleg Nesterov <oleg@redhat.com>,
	linux-mm@kvack.org, linux-kernel@vger.kernel.org,
	Michal Hocko <mhocko@suse.cz>
Subject: Re: [PATCH 5/5] mm, memcontrol: use vma_is_anonymous() to check for anon VMA
Date: Mon, 13 Jul 2015 16:20:56 +0300 (EEST)	[thread overview]
Message-ID: <20150713132056.D0CDAA4@black.fi.intel.com> (raw)
In-Reply-To: <20150713130812.GA8115@cmpxchg.org>

Johannes Weiner wrote:
> On Mon, Jul 13, 2015 at 01:54:12PM +0300, Kirill A. Shutemov wrote:
> > !vma->vm_file is not reliable to detect anon VMA, because not all
> > drivers bother set it. Let's use vma_is_anonymous() instead.
> > 
> > Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
> > Cc: Johannes Weiner <hannes@cmpxchg.org>
> > Cc: Michal Hocko <mhocko@suse.cz>
> > ---
> >  mm/memcontrol.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/mm/memcontrol.c b/mm/memcontrol.c
> > index acb93c554f6e..a624709f0dd7 100644
> > --- a/mm/memcontrol.c
> > +++ b/mm/memcontrol.c
> > @@ -4809,7 +4809,7 @@ static struct page *mc_handle_file_pte(struct vm_area_struct *vma,
> >  	struct address_space *mapping;
> >  	pgoff_t pgoff;
> >  
> > -	if (!vma->vm_file) /* anonymous vma */
> > +	if (vma_is_anonymous(vma)) /* anonymous vma */
> >  		return NULL;
> >  	if (!(mc.flags & MOVE_FILE))
> >  		return NULL;
> 
> The next line does vma->vm_file->f_mapping, so it had better be !NULL.
> 
> It's not about reliably detecting anonymous vs. file, it is about
> whether there is a mapping against which we can do find_get_page().

You're right. This patch is totally broken.

-- 
 Kirill

  reply	other threads:[~2015-07-13 13:21 UTC|newest]

Thread overview: 42+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-07-13 10:54 [PATCH 0/5] Make vma_is_anonymous() reliable Kirill A. Shutemov
2015-07-13 10:54 ` Kirill A. Shutemov
2015-07-13 10:54 ` [PATCH 1/5] mm: mark most vm_operations_struct const Kirill A. Shutemov
2015-07-13 10:54   ` Kirill A. Shutemov
2015-07-13 10:54 ` [PATCH 2/5] x86, mpx: do not set ->vm_ops on mpx VMAs Kirill A. Shutemov
2015-07-13 10:54   ` Kirill A. Shutemov
2015-07-13 12:06   ` Leon Romanovsky
2015-07-13 12:06     ` Leon Romanovsky
2015-07-13 12:29     ` Kirill A. Shutemov
2015-07-13 12:29       ` Kirill A. Shutemov
2015-07-13 12:42       ` Leon Romanovsky
2015-07-13 12:42         ` Leon Romanovsky
2015-07-13 16:53   ` Oleg Nesterov
2015-07-13 16:53     ` Oleg Nesterov
2015-07-13 17:05     ` Dave Hansen
2015-07-13 17:05       ` Dave Hansen
2015-07-16 11:05       ` Kirill A. Shutemov
2015-07-16 11:05         ` Kirill A. Shutemov
2015-07-16 15:53         ` Dave Hansen
2015-07-16 15:53           ` Dave Hansen
2015-07-16 16:09           ` Kirill A. Shutemov
2015-07-16 16:09             ` Kirill A. Shutemov
2015-07-16 22:26             ` [PATCH 0/1] mm, mpx: add "vm_flags_t vm_flags" arg to do_mmap_pgoff() Oleg Nesterov
2015-07-16 22:26               ` Oleg Nesterov
2015-07-16 22:26               ` [PATCH 1/1] " Oleg Nesterov
2015-07-16 22:26                 ` Oleg Nesterov
2015-07-24 14:39                 ` Paul Gortmaker
2015-07-24 14:39                   ` Paul Gortmaker
2015-07-27 19:34                   ` Mark Salter
2015-07-27 19:34                     ` Mark Salter
2015-07-13 10:54 ` [PATCH 3/5] mm: make sure all file VMAs have ->vm_ops set Kirill A. Shutemov
2015-07-13 10:54   ` Kirill A. Shutemov
2015-07-13 10:54 ` [PATCH 4/5] mm, madvise: use vma_is_anonymous() to check for anon VMA Kirill A. Shutemov
2015-07-13 10:54   ` Kirill A. Shutemov
2015-07-15 23:50   ` Minchan Kim
2015-07-15 23:50     ` Minchan Kim
2015-07-13 10:54 ` [PATCH 5/5] mm, memcontrol: " Kirill A. Shutemov
2015-07-13 10:54   ` Kirill A. Shutemov
2015-07-13 13:08   ` Johannes Weiner
2015-07-13 13:08     ` Johannes Weiner
2015-07-13 13:20     ` Kirill A. Shutemov [this message]
2015-07-13 13:20       ` Kirill A. Shutemov

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=20150713132056.D0CDAA4@black.fi.intel.com \
    --to=kirill.shutemov@linux.intel.com \
    --cc=akpm@linux-foundation.org \
    --cc=hannes@cmpxchg.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mhocko@suse.cz \
    --cc=oleg@redhat.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 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.