From: Andrew Morton <akpm@linux-foundation.org>
To: mm-commits@vger.kernel.org, linmiaohe@huawei.com,
akpm@linux-foundation.org
Subject: + mm-mremap-use-helper-mlock_future_check.patch added to -mm tree
Date: Fri, 25 Mar 2022 17:20:10 -0700 [thread overview]
Message-ID: <20220326002011.BD52FC2BBE4@smtp.kernel.org> (raw)
The patch titled
Subject: mm/mremap: use helper mlock_future_check()
has been added to the -mm tree. Its filename is
mm-mremap-use-helper-mlock_future_check.patch
This patch should soon appear at
https://ozlabs.org/~akpm/mmots/broken-out/mm-mremap-use-helper-mlock_future_check.patch
and later at
https://ozlabs.org/~akpm/mmotm/broken-out/mm-mremap-use-helper-mlock_future_check.patch
Before you just go and hit "reply", please:
a) Consider who else should be cc'ed
b) Prefer to cc a suitable mailing list as well
c) Ideally: find the original patch on the mailing list and do a
reply-to-all to that, adding suitable additional cc's
*** Remember to use Documentation/process/submit-checklist.rst when testing your code ***
The -mm tree is included into linux-next and is updated
there every 3-4 working days
------------------------------------------------------
From: Miaohe Lin <linmiaohe@huawei.com>
Subject: mm/mremap: use helper mlock_future_check()
Use helper mlock_future_check() to check whether it's safe to resize the
locked_vm to simplify the code. Minor readability improvement.
Link: https://lkml.kernel.org/r/20220322112004.27380-1-linmiaohe@huawei.com
Signed-off-by: Miaohe Lin <linmiaohe@huawei.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---
mm/mremap.c | 10 ++--------
1 file changed, 2 insertions(+), 8 deletions(-)
--- a/mm/mremap.c~mm-mremap-use-helper-mlock_future_check
+++ a/mm/mremap.c
@@ -763,14 +763,8 @@ static struct vm_area_struct *vma_to_res
if (vma->vm_flags & (VM_DONTEXPAND | VM_PFNMAP))
return ERR_PTR(-EFAULT);
- if (vma->vm_flags & VM_LOCKED) {
- unsigned long locked, lock_limit;
- locked = mm->locked_vm << PAGE_SHIFT;
- lock_limit = rlimit(RLIMIT_MEMLOCK);
- locked += new_len - old_len;
- if (locked > lock_limit && !capable(CAP_IPC_LOCK))
- return ERR_PTR(-EAGAIN);
- }
+ if (mlock_future_check(mm, vma->vm_flags, new_len - old_len))
+ return ERR_PTR(-EAGAIN);
if (!may_expand_vm(mm, vma->vm_flags,
(new_len - old_len) >> PAGE_SHIFT))
_
Patches currently in -mm which might be from linmiaohe@huawei.com are
mm-mremap-use-helper-mlock_future_check.patch
reply other threads:[~2022-03-26 0:20 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=20220326002011.BD52FC2BBE4@smtp.kernel.org \
--to=akpm@linux-foundation.org \
--cc=linmiaohe@huawei.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mm-commits@vger.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 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.