Re: [PATCH -v2] Resource: fix region_intersects() for CXL memory

From: Andy Shevchenko
Date: Thu Sep 05 2024 - 06:58:04 EST


On Thu, Sep 05, 2024 at 11:00:14AM +0800, Huang, Ying wrote:
> Andy Shevchenko <andriy.shevchenko@xxxxxxxxxxxxxxx> writes:
> > On Wed, Sep 04, 2024 at 03:48:44PM +0800, Huang, Ying wrote:
> >> Andy Shevchenko <andriy.shevchenko@xxxxxxxxxxxxxxx> writes:
> >> > On Mon, Aug 19, 2024 at 10:34:13AM +0800, Huang Ying wrote:

[snip]

> >> >> + ostart = max(res.start, p->start);
> >> >> + oend = min(res.end, p->end);
> >> >
> >> > Isn't a reinvention of resource_intersection()? With that in place you may also
> >> > drop the above resource_overlaps().
> >>
> >> sizeof(struct resource) == 8 * sizeof(unsigned long)
> >>
> >> Just want to avoid to define another struct resource on stack.
> >
> > Is it a problem?
>
> Not a serious problem. Just prefer to avoid too much stack usage.
> IMHO, the benefit isn't large too.

Benefit is so use existing APIs and see from the code where we handle resources
(in semantic meaning).

--
With Best Regards,
Andy Shevchenko