linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Ankur Arora <ankur.a.arora@oracle.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: Ankur Arora <ankur.a.arora@oracle.com>,
	kernel test robot <lkp@intel.com>,
	oe-kbuild-all@lists.linux.dev,
	"Linux Memory Management List" <linux-mm@kvack.org>,
	Raghavendra K T <raghavendra.kt@amd.com>
Subject: Re: [linux-next:master 7919/9290] include/linux/compiler_types.h:631:38: error: call to '__compiletime_assert_639' declared with attribute error: clamp() low limit pg.start greater than high limit pg.end
Date: Sat, 24 Jan 2026 00:11:49 -0800	[thread overview]
Message-ID: <87sebve8fu.fsf@oracle.com> (raw)
In-Reply-To: <20260123174839.334fa31ce9ee6633d471aecb@linux-foundation.org>


Andrew Morton <akpm@linux-foundation.org> writes:

> On Fri, 23 Jan 2026 15:31:08 -0800 Ankur Arora <ankur.a.arora@oracle.com> wrote:
>
>>
>> kernel test robot <lkp@intel.com> writes:
>>
>> > tree:   https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master
>> > head:   a0c666c25aeefd16f4b088c6549a6fb6b65a8a1d
>> > commit: 93552c9a3350fff06543da18e4c80d3e804191ca [7919/9290] mm: folio_zero_user: cache neighbouring pages
>> > config: riscv-randconfig-002-20260124 (https://download.01.org/0day-ci/archive/20260124/202601240453.QCjgGdJa-lkp@intel.com/config)
>> > compiler: riscv64-linux-gcc (GCC) 8.5.0
>> > reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260124/202601240453.QCjgGdJa-lkp@intel.com/reproduce)
>>
>> Oddly enough I'm unable to reproduce this with:
>>    ARCH=riscv CROSS_COMPILE=riscv64-linux-gnu- make O=build_dir/ W=1 mm/
>
> I couldn't.  gcc-15.2.0.

I had gcc-12.1.1.

>> > If you fix the issue in a separate patch/commit (i.e. not just a new version of
>> > the same patch/commit), kindly add following tags
>> > | Reported-by: kernel test robot <lkp@intel.com>
>> > | Closes: https://lore.kernel.org/oe-kbuild-all/202601240453.QCjgGdJa-lkp@intel.com/
>> >
>> > All errors (new ones prefixed by >>):
>> >
>> >    In file included from include/linux/mm.h:18,
>> >                     from arch/riscv/include/asm/sections.h:9,
>> >                     from include/linux/interrupt.h:22,
>> >                     from include/linux/kernel_stat.h:8,
>> >                     from mm/memory.c:42:
>> >    mm/memory.c: In function 'folio_zero_user':
>> >>> include/linux/compiler_types.h:631:38: error: call to '__compiletime_assert_639' declared with attribute error: clamp() low limit pg.start greater than high limit pg.end
>>
>> I'm a bit puzzled by this assert.
>>
>> folio_zero_user():
>>    {
>> 	const unsigned long base_addr = ALIGN_DOWN(addr_hint, folio_size(folio));
>> 	const long fault_idx = (addr_hint - base_addr) / PAGE_SIZE;
>> 	const struct range pg = DEFINE_RANGE(0, folio_nr_pages(folio) - 1);
>> 	const int radius = FOLIO_ZERO_LOCALITY_RADIUS;
>> 	struct range r[3];
>> 	int i;
>>
>> 	/*
>> 	 * Faulting page and its immediate neighbourhood. Will be cleared at the
>> 	 * end to keep its cachelines hot.
>> 	 */
>> 	r[2] = DEFINE_RANGE(clamp_t(s64, fault_idx - radius, pg.start, pg.end),
>> 			    clamp_t(s64, fault_idx + radius, pg.start, pg.end));
>
> This line expands to 2846 bytes of C.  The clamp()y functions are asking a lot
> of the compiler - their development was drama-filled.
>
> If we want to work around this (and I guess we should) then simply
> open-coding these operations would be a good approach?

Yeah, let me work on that.

--
ankur


      reply	other threads:[~2026-01-24  8:12 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-01-23 20:29 kernel test robot
2026-01-23 23:31 ` Ankur Arora
2026-01-24  1:48   ` Andrew Morton
2026-01-24  8:11     ` Ankur Arora [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=87sebve8fu.fsf@oracle.com \
    --to=ankur.a.arora@oracle.com \
    --cc=akpm@linux-foundation.org \
    --cc=linux-mm@kvack.org \
    --cc=lkp@intel.com \
    --cc=oe-kbuild-all@lists.linux.dev \
    --cc=raghavendra.kt@amd.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox