All of lore.kernel.org
 help / color / mirror / Atom feed
From: Alistair Popple <apopple@nvidia.com>
To: "linux-mm@kvack.org" <linux-mm@kvack.org>,
	Bharat Kumar Gogada <bharatku@xilinx.com>
Cc: "jglisse@redhat.com" <jglisse@redhat.com>
Subject: Re: HMM hmm_range parameter usage
Date: Mon, 6 Jun 2022 23:56:13 +1000	[thread overview]
Message-ID: <4457209.NlDKVFkA3t@nvdebian> (raw)
In-Reply-To: <BY5PR02MB69474464D28B2E205FE47146A5A29@BY5PR02MB6947.namprd02.prod.outlook.com>

On Monday, 6 June 2022 10:27:20 PM AEST Bharat Kumar Gogada wrote:
> Hi All,
> 
> In 5.4 kernel hmm_range structure has pfn_shift parameter. 
> This parameter is removed in the latest kernel.
> 
> Can any one help me understand usage of this parameter ?

I think originally it was intended to help hmm_range_fault() format PFNs into 
some kind of HW specific value, but it turned out not to be very useful - see 
2733ea144dcc ("2733ea144dcce789de20988c1056e228a07b1bff") for more background. 
I think just setting it to PAGE_SHIFT would be fine.

> In 5.4 kernel, if this parameter set to PAGE_SHIFT, does it mean HMM 
framework 
> expects user buffers to be 4K aligned, i.e which are allocated via mmap/
aligned_alloc ?

It doesn't matter what the pfn_shift parameter is set to as HMM just copies 
(and reformats) CPU page tables so minimum alignment would be PAGE_SIZE (ie. 
generally 4K). HMM doesn't add any extra alignment constraints.

> Does HMM have any alignment requirements in 5.4 or current kernel ? Will it 
work 
> with buffers allocated via malloc ?

Yes. It should work with any normal page with present PTEs although I haven't 
personally tested it with v5.4 in a long time. There's been a number of 
changes in this area so I'd recommend trying to use a more recent kernel if 
possible.

 - Alistair

> Regards,
> bharat 
> 
>  
> 
> 
> 






      reply	other threads:[~2022-06-06 13:56 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-06 12:27 HMM hmm_range parameter usage Bharat Kumar Gogada
2022-06-06 13:56 ` Alistair Popple [this message]

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=4457209.NlDKVFkA3t@nvdebian \
    --to=apopple@nvidia.com \
    --cc=bharatku@xilinx.com \
    --cc=jglisse@redhat.com \
    --cc=linux-mm@kvack.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 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.