Re: [PATCH hmm 6/6] mm/hmm: use device_private_entry_to_pfn()

2020-03-23 Thread Jason Gunthorpe
On Sat, Mar 21, 2020 at 09:43:47AM +0100, Christoph Hellwig wrote:
> On Fri, Mar 20, 2020 at 01:49:05PM -0300, Jason Gunthorpe wrote:
> > From: Jason Gunthorpe 
> > 
> > swp_offset() should not be called directly, the wrappers are supposed to
> > abstract away the encoding of the device_private specific information in
> > the swap entry.
> > 
> > Signed-off-by: Jason Gunthorpe 
> >  mm/hmm.c | 4 ++--
> >  1 file changed, 2 insertions(+), 2 deletions(-)
> > 
> > diff --git a/mm/hmm.c b/mm/hmm.c
> > index a09b4908e9c81a..fd9ee2b5fd9989 100644
> > +++ b/mm/hmm.c
> > @@ -259,8 +259,8 @@ static int hmm_vma_handle_pte(struct mm_walk *walk, 
> > unsigned long addr,
> >  * the PFN even if not present.
> >  */
> > if (hmm_is_device_private_entry(range, entry)) {
> > -   *pfn = hmm_device_entry_from_pfn(range,
> > -   swp_offset(entry));
> > +   *pfn = hmm_device_entry_from_pfn(
> > +   range, device_private_entry_to_pfn(entry));
> 
> The range parameter can stay on the first line..

Done. Makes the diff smaller.

Thanks,
Jason
___
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx


Re: [PATCH hmm 6/6] mm/hmm: use device_private_entry_to_pfn()

2020-03-21 Thread Christoph Hellwig
On Fri, Mar 20, 2020 at 01:49:05PM -0300, Jason Gunthorpe wrote:
> From: Jason Gunthorpe 
> 
> swp_offset() should not be called directly, the wrappers are supposed to
> abstract away the encoding of the device_private specific information in
> the swap entry.
> 
> Signed-off-by: Jason Gunthorpe 
> ---
>  mm/hmm.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/mm/hmm.c b/mm/hmm.c
> index a09b4908e9c81a..fd9ee2b5fd9989 100644
> --- a/mm/hmm.c
> +++ b/mm/hmm.c
> @@ -259,8 +259,8 @@ static int hmm_vma_handle_pte(struct mm_walk *walk, 
> unsigned long addr,
>* the PFN even if not present.
>*/
>   if (hmm_is_device_private_entry(range, entry)) {
> - *pfn = hmm_device_entry_from_pfn(range,
> - swp_offset(entry));
> + *pfn = hmm_device_entry_from_pfn(
> + range, device_private_entry_to_pfn(entry));

The range parameter can stay on the first line..
___
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx


[PATCH hmm 6/6] mm/hmm: use device_private_entry_to_pfn()

2020-03-20 Thread Jason Gunthorpe
From: Jason Gunthorpe 

swp_offset() should not be called directly, the wrappers are supposed to
abstract away the encoding of the device_private specific information in
the swap entry.

Signed-off-by: Jason Gunthorpe 
---
 mm/hmm.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/mm/hmm.c b/mm/hmm.c
index a09b4908e9c81a..fd9ee2b5fd9989 100644
--- a/mm/hmm.c
+++ b/mm/hmm.c
@@ -259,8 +259,8 @@ static int hmm_vma_handle_pte(struct mm_walk *walk, 
unsigned long addr,
 * the PFN even if not present.
 */
if (hmm_is_device_private_entry(range, entry)) {
-   *pfn = hmm_device_entry_from_pfn(range,
-   swp_offset(entry));
+   *pfn = hmm_device_entry_from_pfn(
+   range, device_private_entry_to_pfn(entry));
*pfn |= range->flags[HMM_PFN_VALID];
if (is_write_device_private_entry(entry))
*pfn |= range->flags[HMM_PFN_WRITE];
-- 
2.25.1

___
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx