All of lore.kernel.org
 help / color / mirror / Atom feed
From: Matthew Wilcox <willy@infradead.org>
To: Alex Sierra <alex.sierra@amd.com>
Cc: jgg@nvidia.com, david@redhat.com, Felix.Kuehling@amd.com,
	linux-mm@kvack.org, rcampbell@nvidia.com,
	linux-ext4@vger.kernel.org, linux-xfs@vger.kernel.org,
	amd-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org,
	hch@lst.de, jglisse@redhat.com, apopple@nvidia.com,
	akpm@linux-foundation.org
Subject: Re: [PATCH v1 1/3] mm: split vm_normal_pages for LRU and non-LRU handling
Date: Thu, 10 Mar 2022 19:25:30 +0000	[thread overview]
Message-ID: <YipQqqpTz8hZAbLZ@casper.infradead.org> (raw)
In-Reply-To: <20220310172633.9151-2-alex.sierra@amd.com>

On Thu, Mar 10, 2022 at 11:26:31AM -0600, Alex Sierra wrote:
> @@ -606,7 +606,7 @@ static void print_bad_pte(struct vm_area_struct *vma, unsigned long addr,
>   * PFNMAP mappings in order to support COWable mappings.
>   *
>   */
> -struct page *vm_normal_page(struct vm_area_struct *vma, unsigned long addr,
> +struct page *vm_normal_any_page(struct vm_area_struct *vma, unsigned long addr,
>  			    pte_t pte)
>  {
>  	unsigned long pfn = pte_pfn(pte);
> @@ -620,8 +620,6 @@ struct page *vm_normal_page(struct vm_area_struct *vma, unsigned long addr,
>  			return NULL;
>  		if (is_zero_pfn(pfn))
>  			return NULL;
> -		if (pte_devmap(pte))
> -			return NULL;
>  
>  		print_bad_pte(vma, addr, pte, NULL);
>  		return NULL;

... what?

Haven't you just made it so that a devmap page always prints a bad PTE
message, and then returns NULL anyway?

Surely this should be:

		if (pte_devmap(pte))
-			return NULL;
+			return pfn_to_page(pfn);

or maybe

+			goto check_pfn;

But I don't know about that highest_memmap_pfn check.

> @@ -661,6 +659,22 @@ struct page *vm_normal_page(struct vm_area_struct *vma, unsigned long addr,
>  	return pfn_to_page(pfn);
>  }
>  
> +/*
> + * vm_normal_lru_page -- This function gets the "struct page" associated
> + * with a pte only for page cache and anon page. These pages are LRU handled.
> + */
> +struct page *vm_normal_lru_page(struct vm_area_struct *vma, unsigned long addr,
> +			    pte_t pte)

It seems a shame to add a new function without proper kernel-doc.


WARNING: multiple messages have this Message-ID (diff)
From: Matthew Wilcox <willy@infradead.org>
To: Alex Sierra <alex.sierra@amd.com>
Cc: rcampbell@nvidia.com, david@redhat.com, Felix.Kuehling@amd.com,
	apopple@nvidia.com, amd-gfx@lists.freedesktop.org,
	linux-xfs@vger.kernel.org, linux-mm@kvack.org,
	jglisse@redhat.com, dri-devel@lists.freedesktop.org,
	jgg@nvidia.com, akpm@linux-foundation.org,
	linux-ext4@vger.kernel.org, hch@lst.de
Subject: Re: [PATCH v1 1/3] mm: split vm_normal_pages for LRU and non-LRU handling
Date: Thu, 10 Mar 2022 19:25:30 +0000	[thread overview]
Message-ID: <YipQqqpTz8hZAbLZ@casper.infradead.org> (raw)
In-Reply-To: <20220310172633.9151-2-alex.sierra@amd.com>

On Thu, Mar 10, 2022 at 11:26:31AM -0600, Alex Sierra wrote:
> @@ -606,7 +606,7 @@ static void print_bad_pte(struct vm_area_struct *vma, unsigned long addr,
>   * PFNMAP mappings in order to support COWable mappings.
>   *
>   */
> -struct page *vm_normal_page(struct vm_area_struct *vma, unsigned long addr,
> +struct page *vm_normal_any_page(struct vm_area_struct *vma, unsigned long addr,
>  			    pte_t pte)
>  {
>  	unsigned long pfn = pte_pfn(pte);
> @@ -620,8 +620,6 @@ struct page *vm_normal_page(struct vm_area_struct *vma, unsigned long addr,
>  			return NULL;
>  		if (is_zero_pfn(pfn))
>  			return NULL;
> -		if (pte_devmap(pte))
> -			return NULL;
>  
>  		print_bad_pte(vma, addr, pte, NULL);
>  		return NULL;

... what?

Haven't you just made it so that a devmap page always prints a bad PTE
message, and then returns NULL anyway?

Surely this should be:

		if (pte_devmap(pte))
-			return NULL;
+			return pfn_to_page(pfn);

or maybe

+			goto check_pfn;

But I don't know about that highest_memmap_pfn check.

> @@ -661,6 +659,22 @@ struct page *vm_normal_page(struct vm_area_struct *vma, unsigned long addr,
>  	return pfn_to_page(pfn);
>  }
>  
> +/*
> + * vm_normal_lru_page -- This function gets the "struct page" associated
> + * with a pte only for page cache and anon page. These pages are LRU handled.
> + */
> +struct page *vm_normal_lru_page(struct vm_area_struct *vma, unsigned long addr,
> +			    pte_t pte)

It seems a shame to add a new function without proper kernel-doc.


  reply	other threads:[~2022-03-10 19:25 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-10 17:26 [PATCH v1 0/3] split vm_normal_pages for LRU and non-LRU handling Alex Sierra
2022-03-10 17:26 ` Alex Sierra
2022-03-10 17:26 ` [PATCH v1 1/3] mm: " Alex Sierra
2022-03-10 17:26   ` Alex Sierra
2022-03-10 19:25   ` Matthew Wilcox [this message]
2022-03-10 19:25     ` Matthew Wilcox
2022-03-10 21:58     ` Felix Kuehling
2022-03-10 21:58       ` Felix Kuehling
2022-03-17  2:50       ` Alistair Popple
2022-03-17  2:50         ` Alistair Popple
2022-03-11  9:16   ` David Hildenbrand
2022-03-11  9:16     ` David Hildenbrand
2022-03-11 17:08     ` Felix Kuehling
2022-03-11 17:08       ` Felix Kuehling
2022-03-17  2:54       ` Alistair Popple
2022-03-17  2:54         ` Alistair Popple
2022-03-17  8:13         ` David Hildenbrand
2022-03-17  8:13           ` David Hildenbrand
2022-03-17 13:25           ` Jason Gunthorpe
2022-03-17 13:25             ` Jason Gunthorpe
2022-03-10 17:26 ` [PATCH v1 2/3] tools: add more gup configs to hmm_gup selftests Alex Sierra
2022-03-10 17:26   ` Alex Sierra
2022-03-10 17:26 ` [PATCH v1 3/3] tools: add selftests to hmm for COW in device memory Alex Sierra
2022-03-10 17:26   ` Alex Sierra

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=YipQqqpTz8hZAbLZ@casper.infradead.org \
    --to=willy@infradead.org \
    --cc=Felix.Kuehling@amd.com \
    --cc=akpm@linux-foundation.org \
    --cc=alex.sierra@amd.com \
    --cc=amd-gfx@lists.freedesktop.org \
    --cc=apopple@nvidia.com \
    --cc=david@redhat.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=hch@lst.de \
    --cc=jgg@nvidia.com \
    --cc=jglisse@redhat.com \
    --cc=linux-ext4@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=linux-xfs@vger.kernel.org \
    --cc=rcampbell@nvidia.com \
    /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.