[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <CB2E02DB-0675-4053-B223-06D4BF26641C@gmail.com>
Date: Mon, 27 Sep 2021 13:36:20 -0700
From: Nadav Amit <nadav.amit@...il.com>
To: "Kirill A. Shutemov" <kirill@...temov.name>
Cc: Andrew Morton <akpm@...ux-foundation.org>,
Linux-MM <linux-mm@...ck.org>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
Peter Xu <peterx@...hat.com>,
Andrea Arcangeli <aarcange@...hat.com>,
Minchan Kim <minchan@...nel.org>,
Colin Cross <ccross@...gle.com>,
Suren Baghdasarya <surenb@...gle.com>,
Mike Rapoport <rppt@...ux.vnet.ibm.com>
Subject: Re: [RFC PATCH 4/8] mm/madvise: define madvise behavior in a struct
> On Sep 27, 2021, at 5:14 AM, Kirill A. Shutemov <kirill@...temov.name> wrote:
>
> On Mon, Sep 27, 2021 at 03:31:21AM -0700, Nadav Amit wrote:
>>
>>
>>> On Sep 27, 2021, at 2:31 AM, Kirill A. Shutemov <kirill@...temov.name> wrote:
>>>
>>> On Sun, Sep 26, 2021 at 09:12:55AM -0700, Nadav Amit wrote:
>>>> From: Nadav Amit <namit@...are.com>
>>>>
>>>> The different behaviors of madvise are different in several ways, which
>>>> are distributed across several functions. Use the design pattern from
>>>> iouring in order to define the actions that are required for each
>>>> behavior.
>>>>
>>>> The next patches will get rid of old helper functions that are modified
>>>> in this patch and the redundant use of array_index_nospec(). The next
>>>> patches will add more actions for each leaf into the new struct.
>>>
[ snip ]
>>> MADV_SOFT_OFFLINE+1 smells bad.
>>
>> I can set another constant instead and let the compiler shout if anything
>> outside the array is initialized.
>
> I would rather introduce a function that would return struct madvise_info
> for a given behavior. The function would have a switch inside. The default:
> may have BUILD_BUG() or something.
Sounds better than my solution. I will do so.
Powered by blists - more mailing lists