From: Andrew Morton <akpm@linux-foundation.org>
To: mm-commits@vger.kernel.org,yi1.lai@linux.intel.com,sj@kernel.org,shakeel.butt@linux.dev,naresh.kamboju@linaro.org,howlett@gmail.com,dave@stgolabs.net,arnd@arndb.de,lorenzo.stoakes@oracle.com,akpm@linux-foundation.org
Subject: [folded-merged] mm-madvise-split-out-mmap-locking-operations-for-madvise-fix.patch removed from -mm tree
Date: Sun, 16 Mar 2025 21:31:03 -0700 [thread overview]
Message-ID: <20250317043104.6E2F2C4CEEC@smtp.kernel.org> (raw)
The quilt patch titled
Subject: mm/madvise: fix madvise_[un]lock() issue
has been removed from the -mm tree. Its filename was
mm-madvise-split-out-mmap-locking-operations-for-madvise-fix.patch
This patch was dropped because it was folded into mm-madvise-split-out-mmap-locking-operations-for-madvise.patch
------------------------------------------------------
From: Lorenzo Stoakes <lorenzo.stoakes@oracle.com>
Subject: mm/madvise: fix madvise_[un]lock() issue
Date: Tue, 11 Feb 2025 10:44:26 +0000
We are asymmetric in our locking/unlocking in the case of memory failure
madvise() behaviour options, correct this and abstract the memory failure
check.
Link: https://lkml.kernel.org/r/2f448f7b-1da7-4099-aa9e-0179d47fde40@lucifer.local
Signed-off-by: Lorenzo Stoakes <lorenzo.stoakes@oracle.com>
Reported-by: "Lai, Yi" <yi1.lai@linux.intel.com>
Closes: https://lore.kernel.org/Z6rgiVp7221r4JZ5@ly-workstation
Reviewed-by: SeongJae Park <sj@kernel.org>
Tested-by: SeongJae Park <sj@kernel.org>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Davidlohr Bueso <dave@stgolabs.net>
Cc: Liam R. Howlett <howlett@gmail.com>
Cc: Naresh Kamboju <naresh.kamboju@linaro.org>
Cc: Shakeel Butt <shakeel.butt@linux.dev>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---
mm/madvise.c | 29 +++++++++++++++++++++++------
1 file changed, 23 insertions(+), 6 deletions(-)
--- a/mm/madvise.c~mm-madvise-split-out-mmap-locking-operations-for-madvise-fix
+++ a/mm/madvise.c
@@ -1575,14 +1575,29 @@ int madvise_set_anon_name(struct mm_stru
}
#endif /* CONFIG_ANON_VMA_NAME */
-static int madvise_lock(struct mm_struct *mm, int behavior)
-{
-
#ifdef CONFIG_MEMORY_FAILURE
- if (behavior == MADV_HWPOISON || behavior == MADV_SOFT_OFFLINE)
- return 0;
+static bool is_memory_failure(int behavior)
+{
+ switch (behavior) {
+ case MADV_HWPOISON:
+ case MADV_SOFT_OFFLINE:
+ return true;
+ default:
+ return false;
+ }
+}
+#else
+static bool is_memory_failure(int behavior)
+{
+ return false;
+}
#endif
+static int madvise_lock(struct mm_struct *mm, int behavior)
+{
+ if (is_memory_failure(behavior))
+ return 0;
+
if (madvise_need_mmap_write(behavior)) {
if (mmap_write_lock_killable(mm))
return -EINTR;
@@ -1590,11 +1605,13 @@ static int madvise_lock(struct mm_struct
mmap_read_lock(mm);
}
return 0;
-
}
static void madvise_unlock(struct mm_struct *mm, int behavior)
{
+ if (is_memory_failure(behavior))
+ return;
+
if (madvise_need_mmap_write(behavior))
mmap_write_unlock(mm);
else
_
Patches currently in -mm which might be from lorenzo.stoakes@oracle.com are
mm-simplify-vma-merge-structure-and-expand-comments.patch
mm-further-refactor-commit_merge.patch
mm-eliminate-adj_start-parameter-from-commit_merge.patch
mm-make-vmg-target-consistent-and-further-simplify-commit_merge.patch
mm-completely-abstract-unnecessary-adj_start-calculation.patch
mm-madvise-split-out-mmap-locking-operations-for-madvise.patch
mm-use-read-write_once-for-vma-vm_flags-on-migrate-mprotect.patch
mm-refactor-rmap_walk_file-to-separate-out-traversal-logic.patch
mm-provide-mapping_wrprotect_range-function.patch
fb_defio-do-not-use-deprecated-page-mapping-index-fields.patch
fb_defio-do-not-use-deprecated-page-mapping-index-fields-fix.patch
mm-allow-guard-regions-in-file-backed-and-read-only-mappings.patch
selftests-mm-rename-guard-pages-to-guard-regions.patch
selftests-mm-rename-guard-pages-to-guard-regions-fix.patch
tools-selftests-expand-all-guard-region-tests-to-file-backed.patch
tools-selftests-add-file-shmem-backed-mapping-guard-region-tests.patch
fs-proc-task_mmu-add-guard-region-bit-to-pagemap.patch
tools-selftests-add-guard-region-test-for-proc-pid-pagemap.patch
tools-selftests-add-guard-region-test-for-proc-pid-pagemap-fix.patch
mm-mremap-correctly-handle-partial-mremap-of-vma-starting-at-0.patch
mm-mremap-refactor-mremap-system-call-implementation.patch
mm-mremap-introduce-and-use-vma_remap_struct-threaded-state.patch
mm-mremap-initial-refactor-of-move_vma.patch
mm-mremap-complete-refactor-of-move_vma.patch
mm-mremap-refactor-move_page_tables-abstracting-state.patch
mm-mremap-thread-state-through-move-page-table-operation.patch
reply other threads:[~2025-03-17 4:31 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20250317043104.6E2F2C4CEEC@smtp.kernel.org \
--to=akpm@linux-foundation.org \
--cc=arnd@arndb.de \
--cc=dave@stgolabs.net \
--cc=howlett@gmail.com \
--cc=lorenzo.stoakes@oracle.com \
--cc=mm-commits@vger.kernel.org \
--cc=naresh.kamboju@linaro.org \
--cc=shakeel.butt@linux.dev \
--cc=sj@kernel.org \
--cc=yi1.lai@linux.intel.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.