All of lore.kernel.org
 help / color / mirror / Atom feed
From: Uladzislau Rezki <urezki@gmail.com>
To: Shivam Kalra <shivamkalra98@zohomail.in>
Cc: Uladzislau Rezki <urezki@gmail.com>,
	Alice Ryhl <aliceryhl@google.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	linux-mm@kvack.org, linux-kernel@vger.kernel.org,
	Danilo Krummrich <dakr@kernel.org>
Subject: Re: [PATCH v10 0/4] mm/vmalloc: free unused pages on vrealloc() shrink
Date: Fri, 17 Apr 2026 19:24:50 +0200	[thread overview]
Message-ID: <aeJs4jmco7BGCNHq@milan> (raw)
In-Reply-To: <85a9f419-7f1e-41a0-9e8e-67aae7a1b0fe@zohomail.in>

On Fri, Apr 17, 2026 at 07:05:09PM +0530, Shivam Kalra wrote:
> On 16/04/26 00:14, Uladzislau Rezki wrote:
> > Yep, the problem reported by Sashiko regarding area->size and vread_iter()
> > is correct. V10 does not address this.
> > 
> > I am not sure that reducing vma size is a good approach here. It is
> > widely used and we might end up with fixing even more corner cases.
> > 
> > vread_iter() and vm-size calculation there should be fixed.
> > 
> > --
> > Uladzislau Rezki
> Proposed Change for v11:
> 
> long vread_iter(struct iov_iter *iter, const char *addr, size_t count)
> {
> 	struct vmap_node *vn;
> 	struct vmap_area *va;
> 	struct vm_struct *vm;
> 	char *vaddr;
> <snip>
>  		vaddr = (char *) va->va_start;
>  		size = vm ? get_vm_area_size(vm) : va_size(va);
> 		
> 		if (vm && vm->nr_pages)
> 	            size = min(size, (size_t)vm->nr_pages << PAGE_SHIFT);
> 
> <snip>
>
I have some questions to clarify.

Why should we use min()?
Checking vm->nr_pages, can it be 0?

Can we just do:

if (vm)
  /* Can not use get_vm_area_size() because of realloc(). */
  size = vm->nr_pages << PAGE_SHIFT;
else
  size = va_size(va);

or i am missing something?

Thanks!

--
Uladzislau Rezki


  reply	other threads:[~2026-04-17 17:24 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-04  8:36 [PATCH v10 0/4] mm/vmalloc: free unused pages on vrealloc() shrink Shivam Kalra
2026-04-04  8:36 ` Shivam Kalra via B4 Relay
2026-04-04  8:36 ` [PATCH v10 1/4] mm/vmalloc: extract vm_area_free_pages() helper from vfree() Shivam Kalra
2026-04-04  8:36   ` Shivam Kalra via B4 Relay
2026-04-04  8:36 ` [PATCH v10 2/4] mm/vmalloc: use physical page count for vrealloc() grow-in-place check Shivam Kalra
2026-04-04  8:36   ` Shivam Kalra via B4 Relay
2026-04-04  8:36 ` [PATCH v10 3/4] mm/vmalloc: free unused pages on vrealloc() shrink Shivam Kalra
2026-04-04  8:36   ` Shivam Kalra via B4 Relay
2026-04-04  8:37 ` [PATCH v10 4/4] lib/test_vmalloc: add vrealloc test case Shivam Kalra
2026-04-04  8:37   ` Shivam Kalra via B4 Relay
2026-04-14  8:39 ` [PATCH v10 0/4] mm/vmalloc: free unused pages on vrealloc() shrink Shivam Kalra
2026-04-14 16:57   ` Alice Ryhl
2026-04-15 18:44     ` Uladzislau Rezki
2026-04-16  7:38       ` Shivam Kalra
2026-04-17 13:35       ` Shivam Kalra
2026-04-17 17:24         ` Uladzislau Rezki [this message]
2026-04-17 17:34           ` Shivam Kalra
2026-04-20 10:35             ` Uladzislau Rezki

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=aeJs4jmco7BGCNHq@milan \
    --to=urezki@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=aliceryhl@google.com \
    --cc=dakr@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=shivamkalra98@zohomail.in \
    /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.