The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: Avi Weiss <thnkslprpt@gmail.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: David Hildenbrand <david@kernel.org>,
	Lorenzo Stoakes <ljs@kernel.org>,
	"Liam R. Howlett" <liam@infradead.org>,
	Vlastimil Babka <vbabka@kernel.org>,
	Mike Rapoport <rppt@kernel.org>,
	Suren Baghdasaryan <surenb@google.com>,
	Michal Hocko <mhocko@suse.com>,
	Soheil Hassas Yeganeh <soheil@google.com>,
	Arjun Roy <arjunroy@google.com>,
	Eric Dumazet <edumazet@google.com>,
	linux-mm@kvack.org, linux-kernel@vger.kernel.org,
	Avi Weiss <thnkslprpt@gmail.com>
Subject: [PATCH v2 0/3] mm: improve insert_pages() error handling
Date: Wed,  5 Aug 2026 17:42:16 +0300	[thread overview]
Message-ID: <cover.1785847364.git.thnkslprpt@gmail.com> (raw)

Improve insert_pages() error handling following review of the minor
cleanup in v1.

Rename the helper that populates the upper page-table levels, set error
codes at their points of failure, and return -ENOMEM when that
population fails.

Thanks for the review. I'm new to Linux; most of my previous upstream
work has been on NASA cFS and RTEMS.

I agree that initializing the return value to zero and assigning each
relevant error code at its failure site is clearer and more idiomatic.
The second (middle) patch implements that cleanup.

The pte_alloc() macro returns a boolean, so patch 2 tests it and assigns
-ENOMEM explicitly rather than using its return value as an error code.

Changes in v2:

* rename walk_to_pmd() to populate_to_pmd()
* set error codes at their points of failure and rename ret to err
* split the cleanup and return-code change into separate patches
* drop the Fixes tag because this is a general cleanup

Avi Weiss (3):
  mm/memory.c: rename walk_to_pmd() to populate_to_pmd()
  mm/memory.c: simplify error handling in insert_pages()
  mm: return -ENOMEM for page-table allocation failure in insert_pages()

 mm/memory.c | 28 ++++++++++++++--------------
 1 file changed, 14 insertions(+), 14 deletions(-)


base-commit: 848acc8ffe1b7cd5f1bf427b93069becfebc2c9d
-- 
2.43.0


             reply	other threads:[~2026-08-05 14:42 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-05 14:42 Avi Weiss [this message]
2026-08-05 14:42 ` [PATCH v2 1/3] mm/memory.c: rename walk_to_pmd() to populate_to_pmd() Avi Weiss
2026-08-05 14:42 ` [PATCH v2 2/3] mm/memory.c: simplify error handling in insert_pages() Avi Weiss
2026-08-05 14:42 ` [PATCH v2 3/3] mm: return -ENOMEM for page-table allocation failure " Avi Weiss

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=cover.1785847364.git.thnkslprpt@gmail.com \
    --to=thnkslprpt@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=arjunroy@google.com \
    --cc=david@kernel.org \
    --cc=edumazet@google.com \
    --cc=liam@infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=ljs@kernel.org \
    --cc=mhocko@suse.com \
    --cc=rppt@kernel.org \
    --cc=soheil@google.com \
    --cc=surenb@google.com \
    --cc=vbabka@kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox