Re: [PATCH v6 2/6] KVM: s390: pci: Fix memory accounting for pinned/unpinned pages

From: Matthew Rosato

Date: Thu Jul 23 2026 - 22:23:22 EST



> -static inline int account_mem(unsigned long nr_pages)
> +static inline int account_mem(struct kvm_zdev *kzdev, unsigned long nr_pages)
> {
> struct user_struct *user = get_uid(current_user());
> unsigned long page_limit, cur_pages, new_pages;
> + int rc = 0;
>
> page_limit = rlimit(RLIMIT_MEMLOCK) >> PAGE_SHIFT;
>
> cur_pages = atomic_long_read(&user->locked_vm);
> do {
> new_pages = cur_pages + nr_pages;
> - if (new_pages > page_limit)
> - return -ENOMEM;
> + if (new_pages > page_limit) {
> + rc = -ENOMEM;

FYI there is still a double space here, Christian maybe you can just fix when applying?

> + goto out;
> + }