Re: [PATCH v4 11/18] mm/hmm: let users to tag specific PFN with DMA mapped bit

From: Leon Romanovsky
Date: Thu Dec 12 2024 - 03:55:12 EST


On Thu, Dec 12, 2024 at 09:48:56AM +0100, Christoph Hellwig wrote:
> On Thu, Dec 05, 2024 at 03:21:10PM +0200, Leon Romanovsky wrote:
> > From: Leon Romanovsky <leonro@xxxxxxxxxx>
> >
> > Introduce new sticky flag (HMM_PFN_DMA_MAPPED), which isn't overwritten
> > by HMM range fault. Such flag allows users to tag specific PFNs with information
> > if this specific PFN was already DMA mapped.
>
> Missing line wrap at 73 characters here.
>
> >
> > @@ -253,14 +262,14 @@ static int hmm_vma_handle_pte(struct mm_walk *walk, unsigned long addr,
> > cpu_flags = HMM_PFN_VALID;
> > if (is_writable_device_private_entry(entry))
> > cpu_flags |= HMM_PFN_WRITE;
> > - *hmm_pfn = swp_offset_pfn(entry) | cpu_flags;
> > + *hmm_pfn = (*hmm_pfn & HMM_PFN_INOUT_FLAGS) | swp_offset_pfn(entry) | cpu_flags;
>
> Please avoid the overly long line here.
>
> That being said I hate the structure here. Can't we just have a local
> variable for the actual new pfn value, and then a single goto label
> at the end that takes the keeper flags from the argument and assigning
> the new out value to *hmm_pfn instead of duplicating this in half a
> dozen places?

Yes, sure, it makes sense, will do.

>