All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mike Rapoport <rppt@kernel.org>
To: Ivy Lopez <skunkolee@gmail.com>
Cc: akpm@linux-foundation.org, david@kernel.org, ljs@kernel.org,
	liam@infradead.org, vbabka@kernel.org, surenb@google.com,
	mhocko@suse.com, fvdl@google.com, linux-mm@kvack.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 0/2] mm/cma: fix range selection in cma_declare_contiguous_multi()
Date: Thu, 29 Oct 2026 14:22:54 +0200	[thread overview]
Message-ID: <auM6nqlB9FusAr4B@kernel.org> (raw)
In-Reply-To: <cover.1792032699.git.skunkolee@gmail.com>

On Wed, Oct 14, 2026 at 08:53:39PM -0600, Ivy Lopez wrote:
> These two patches fix two independent bugs in the multi-range selection
> of cma_declare_contiguous_multi(), found by code inspection with the
> help of an LLM (both patches carry Assisted-by: LLM).

cma_declare_contiguous_multi() seems broken in many ways.
I'm working on a patch to rewrite it.
 
> Patch 1 fixes list_insert_sorted(), which does not actually sort: it
> stops at the wrong entry and, when no entry matches, inserts before the
> last entry instead of appending. The caller assumes the list tail is the
> smallest recorded range and that the list is walked largest first.
> 
> Patch 2 fixes sizesum counting the size of ranges that were skipped
> because the list was full, so the sizesum < total_size check can pass
> when the recorded ranges cannot cover the request, and the function
> returns 0 having reserved less than asked for.
> 
> Each patch fixes a distinct failure and neither depends on the other.
> No kernel-level reproducer was produced and nothing was tested beyond
> compiling; the examples in the commit messages come from a userspace
> copy of the helper and the selection loop, written from the source.
> 
> Changes in v2:
> - resend as a series with a cover letter, as requested by Lorenzo
> - commit messages now state how the bugs were found and that they were
>   not tested on hardware or in a booted kernel
> - add Assisted-by: LLM
> - patch 1: correct the sentence about the first inserted range staying
>   at the tail (only until it is evicted)
> - rebased on the current akpm/mm-new
> - no code changes
> 
> v1: https://lore.kernel.org/all/20261011003059.169430-1-skunkolee@gmail.com/
> 
> Ivy Lopez (2):
>   mm/cma: fix list_insert_sorted() ordering
>   mm/cma: do not count skipped ranges in cma_declare_contiguous_multi()
> 
>  mm/cma.c | 16 ++++++----------
>  1 file changed, 6 insertions(+), 10 deletions(-)
> 
> -- 
> 2.56.0
> 
> 

-- 
Sincerely yours,
Mike.


      parent reply	other threads:[~2026-10-29 12:23 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-15  2:53 [PATCH v2 0/2] mm/cma: fix range selection in cma_declare_contiguous_multi() Ivy Lopez
2026-10-15  2:53 ` [PATCH v2 1/2] mm/cma: fix list_insert_sorted() ordering Ivy Lopez
2026-10-15 20:43 ` [PATCH v2 2/2] mm/cma: do not count skipped ranges in cma_declare_contiguous_multi() Ivy Lopez
2026-10-29 12:22 ` Mike Rapoport [this message]

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=auM6nqlB9FusAr4B@kernel.org \
    --to=rppt@kernel.org \
    --cc=akpm@linux-foundation.org \
    --cc=david@kernel.org \
    --cc=fvdl@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=skunkolee@gmail.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 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.