All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Siddha, Suresh B" <suresh.b.siddha@intel.com>
To: Badari Pulavarty <pbadari@gmail.com>
Cc: Nick Piggin <nickpiggin@yahoo.com.au>,
	"Siddha, Suresh B" <suresh.b.siddha@intel.com>,
	Ken Chen <kenchen@google.com>, linux-mm <linux-mm@kvack.org>,
	tony.luck@intel.com
Subject: Re: [rfc] lockless get_user_pages for dio (and more)
Date: Mon, 15 Oct 2007 10:49:36 -0700	[thread overview]
Message-ID: <20071015174936.GA10840@linux-os.sc.intel.com> (raw)
In-Reply-To: <1192467832.30128.5.camel@dyn9047017100.beaverton.ibm.com>

On Mon, Oct 15, 2007 at 10:03:52AM -0700, Badari Pulavarty wrote:
> On Mon, 2007-10-15 at 22:25 +1000, Nick Piggin wrote:
> +static int gup_huge_pmd(pmd_t pmd, unsigned long addr, unsigned long
> end, int write, struct page **pages, int *nr)
> +{
> +       pte_t pte = *(pte_t *)&pmd;
> +       struct page *page;
> +
> +       if ((pte_val(pte) & _PAGE_USER) != _PAGE_USER)
> +               return 0;
> +
> +       BUG_ON(!pfn_valid(pte_pfn(pte)));
> +
> +       if (write && !pte_write(pte))
> +               return 0;
> +
> +       page = pte_page(pte);
> +       do {
> +               unsigned long pfn_offset;
> +               struct page *p;
> +
> +               pfn_offset = (addr & ~HPAGE_MASK) >> PAGE_SHIFT;
> +               p = page + pfn_offset;
> +               get_page(page);
> +               pages[*nr] = page;
> +               (*nr)++;
> +
> +       } while (addr += PAGE_SIZE, addr != end);
>                          ^^^^^^^^^^
> 
> Shouldn't this be HPAGE_SIZE ?

I think it is compatible with old code. For a compound page, old code
is taking multiple ref counts and populating pages[] with all the individual
pages that make the compound page. Here, we are almost doing the same
thing (I say almost, because in here pages[] are getting populated with
the head page of the compound page. Anyhow routines like put_page that operate
on these pages should work seamlessly whether we use head/tail page).

thanks,
suresh

--
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:[~2007-10-15 17:49 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-10-08 22:52 [rfc] more granular page table lock for hugepages Siddha, Suresh B
2007-10-09 20:23 ` Ken Chen
2007-10-09 21:05   ` Badari Pulavarty
2007-10-10  0:15     ` Siddha, Suresh B
2007-10-10  6:10       ` Ken Chen
2007-10-10  7:50         ` Ken Chen
2007-10-11 11:39           ` Nick Piggin
2007-10-12 20:34             ` Siddha, Suresh B
2007-10-13 23:27               ` Nick Piggin
2007-10-14  1:01                 ` [rfc] lockless get_user_pages for dio (and more) Nick Piggin
2007-10-14 18:19                   ` Siddha, Suresh B
2007-10-15  4:15                     ` Nick Piggin
2007-10-15 12:25                     ` Nick Piggin
2007-10-15 17:03                       ` Badari Pulavarty
2007-10-15 17:49                         ` Siddha, Suresh B [this message]
2007-10-15 17:54                       ` Siddha, Suresh B
2007-10-15 20:21                       ` Ken Chen
2007-10-16  2:15                         ` Nick Piggin
2007-10-16  0:14                           ` Dave Hansen
2007-10-16  3:26                             ` Nick Piggin
2007-10-16  3:32                           ` Nick Piggin
2007-12-10 21:30                       ` Dave Kleikamp
2007-12-10 21:30                         ` Dave Kleikamp
2007-12-12  4:57                         ` Nick Piggin
2007-12-12  4:57                           ` Nick Piggin
2007-12-12  5:11                           ` Dave Kleikamp
2007-12-12  5:11                             ` Dave Kleikamp
2007-12-12  5:40                             ` Nick Piggin
2007-12-12  5:40                               ` Nick Piggin
2008-01-16 19:58                               ` Dave Kleikamp
2008-01-16 19:58                                 ` Dave Kleikamp
2008-01-17  6:34                                 ` Nick Piggin
2008-01-17  6:34                                   ` Nick Piggin
2008-01-24  7:06                                 ` Nick Piggin
2007-10-14 15:42                 ` [rfc] more granular page table lock for hugepages Siddha, Suresh B
2007-10-15  4:17                   ` Nick Piggin

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=20071015174936.GA10840@linux-os.sc.intel.com \
    --to=suresh.b.siddha@intel.com \
    --cc=kenchen@google.com \
    --cc=linux-mm@kvack.org \
    --cc=nickpiggin@yahoo.com.au \
    --cc=pbadari@gmail.com \
    --cc=tony.luck@intel.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.