linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* HMM hmm_range parameter usage
@ 2022-06-06 12:27 Bharat Kumar Gogada
  2022-06-06 13:56 ` Alistair Popple
  0 siblings, 1 reply; 2+ messages in thread
From: Bharat Kumar Gogada @ 2022-06-06 12:27 UTC (permalink / raw)
  To: linux-mm; +Cc: jglisse

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 ?

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 ?

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

Regards,
bharat 

 


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: HMM hmm_range parameter usage
  2022-06-06 12:27 HMM hmm_range parameter usage Bharat Kumar Gogada
@ 2022-06-06 13:56 ` Alistair Popple
  0 siblings, 0 replies; 2+ messages in thread
From: Alistair Popple @ 2022-06-06 13:56 UTC (permalink / raw)
  To: linux-mm, Bharat Kumar Gogada; +Cc: jglisse

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






^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-06-06 13:56 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-06 12:27 HMM hmm_range parameter usage Bharat Kumar Gogada
2022-06-06 13:56 ` Alistair Popple

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox