From: Ralph Campbell <rcampbell@nvidia.com>
To: Christoph Hellwig <hch@lst.de>
Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org,
amd-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org,
nouveau@lists.freedesktop.org,
"Jérôme Glisse" <jglisse@redhat.com>,
"Jason Gunthorpe" <jgg@mellanox.com>,
"Andrew Morton" <akpm@linux-foundation.org>
Subject: Re: [PATCH 2/4] mm/hmm: allow snapshot of the special zero page
Date: Thu, 12 Sep 2019 10:08:28 -0700 [thread overview]
Message-ID: <6b124c6d-0fac-2a34-0542-7516de939b9e@nvidia.com> (raw)
In-Reply-To: <20190912082648.GB14368@lst.de>
On 9/12/19 1:26 AM, Christoph Hellwig wrote:
> On Wed, Sep 11, 2019 at 03:28:27PM -0700, Ralph Campbell wrote:
>> Allow hmm_range_fault() to return success (0) when the CPU pagetable
>> entry points to the special shared zero page.
>> The caller can then handle the zero page by possibly clearing device
>> private memory instead of DMAing a zero page.
>>
>> Signed-off-by: Ralph Campbell <rcampbell@nvidia.com>
>> Cc: "Jérôme Glisse" <jglisse@redhat.com>
>> Cc: Jason Gunthorpe <jgg@mellanox.com>
>> Cc: Christoph Hellwig <hch@lst.de>
>> ---
>> mm/hmm.c | 2 +-
>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/mm/hmm.c b/mm/hmm.c
>> index 06041d4399ff..7217912bef13 100644
>> --- a/mm/hmm.c
>> +++ b/mm/hmm.c
>> @@ -532,7 +532,7 @@ static int hmm_vma_handle_pte(struct mm_walk *walk, unsigned long addr,
>> return -EBUSY;
>> } else if (IS_ENABLED(CONFIG_ARCH_HAS_PTE_SPECIAL) && pte_special(pte)) {
>> *pfn = range->values[HMM_PFN_SPECIAL];
>> - return -EFAULT;
>> + return is_zero_pfn(pte_pfn(pte)) ? 0 : -EFAULT;
>
> Any chance to just use a normal if here:
>
> if (!is_zero_pfn(pte_pfn(pte)))
> return -EFAULT;
> return 0;
>
Sure, no problem.
next prev parent reply other threads:[~2019-09-12 17:08 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-09-11 22:28 [PATCH 0/4] HMM tests and minor fixes Ralph Campbell
2019-09-11 22:28 ` [PATCH 1/4] mm/hmm: make full use of walk_page_range() Ralph Campbell
2019-09-12 8:26 ` Christoph Hellwig
2019-09-12 17:16 ` Ralph Campbell
2019-09-11 22:28 ` [PATCH 2/4] mm/hmm: allow snapshot of the special zero page Ralph Campbell
2019-09-12 8:26 ` Christoph Hellwig
2019-09-12 17:08 ` Ralph Campbell [this message]
2019-09-11 22:28 ` [PATCH 3/4] mm/hmm: allow hmm_range_fault() of mmap(PROT_NONE) Ralph Campbell
2019-09-11 22:28 ` [PATCH 4/4] mm/hmm/test: add self tests for HMM Ralph Campbell
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=6b124c6d-0fac-2a34-0542-7516de939b9e@nvidia.com \
--to=rcampbell@nvidia.com \
--cc=akpm@linux-foundation.org \
--cc=amd-gfx@lists.freedesktop.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=hch@lst.de \
--cc=jgg@mellanox.com \
--cc=jglisse@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=nouveau@lists.freedesktop.org \
/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