linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Shaohua Li <shli@fb.com>
To: Andi Kleen <andi@firstfloor.org>
Cc: linux-mm@kvack.org, akpm@linux-foundation.org, riel@redhat.com,
	mgorman@suse.de, hughd@google.com, hannes@cmpxchg.org,
	aarcange@redhat.com, je@fb.com, Kernel-team@fb.com
Subject: Re: [RFC] mm: add a new vector based madvise syscall
Date: Mon, 2 Nov 2015 10:16:24 -0800	[thread overview]
Message-ID: <20151102181623.GA3751821@devbig084.prn1.facebook.com> (raw)
In-Reply-To: <871tccaz65.fsf@tassilo.jf.intel.com>

On Fri, Oct 30, 2015 at 01:17:54PM -0700, Andi Kleen wrote:
> Shaohua Li <shli@fb.com> writes:
> > +		vmas[i] = find_vma(current->mm, start);
> > +		/*
> > +		 * don't allow range cross vma, it doesn't make sense for
> > +		 * DONTNEED
> > +		 */
> > +		if (!vmas[i] || start < vmas[i]->vm_start ||
> > +		    start + len > vmas[i]->vm_end) {
> > +			error = -ENOMEM;
> > +			goto up_out;
> > +		}
> > +		if (vmas[i]->vm_flags & (VM_LOCKED|VM_HUGETLB|VM_PFNMAP)) {
> > +			error = -EINVAL;
> > +			goto up_out;
> > +		}
> > +	}
> 
> Needs a cond_resched() somewhere in case the list is very long?

Yep, the zap_pmd_range() has cond_resched(). 
> BTW one trick that may be interesting here is to add a new mode
> that skips the TLB flush completely, but instead waits with
> the freeing until enough context switches to non kernel tasks occurred
> (and flushed the TLB this way). This could be done as part of RCU.

that would not work if the app madvise(DONTNEED) first and then access the
virtual address again.

Thanks,
Shaohua

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

  reply	other threads:[~2015-11-02 18:44 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-10-29 21:55 Shaohua Li
2015-10-30 12:48 ` Rik van Riel
2015-10-30 20:17 ` Andi Kleen
2015-11-02 18:16   ` Shaohua Li [this message]
2015-11-05 13:01 ` Vlastimil Babka

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=20151102181623.GA3751821@devbig084.prn1.facebook.com \
    --to=shli@fb.com \
    --cc=Kernel-team@fb.com \
    --cc=aarcange@redhat.com \
    --cc=akpm@linux-foundation.org \
    --cc=andi@firstfloor.org \
    --cc=hannes@cmpxchg.org \
    --cc=hughd@google.com \
    --cc=je@fb.com \
    --cc=linux-mm@kvack.org \
    --cc=mgorman@suse.de \
    --cc=riel@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox