From: Vlastimil Babka <vbabka@suse.cz>
To: Lorenzo Stoakes <lorenzo.stoakes@oracle.com>,
Andrew Morton <akpm@linux-foundation.org>
Cc: "Liam R . Howlett" <Liam.Howlett@oracle.com>,
Jann Horn <jannh@google.com>,
linux-mm@kvack.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2/5] mm: further refactor commit_merge()
Date: Tue, 28 Jan 2025 16:45:01 +0100 [thread overview]
Message-ID: <09484ff8-1b0c-4101-a793-e869aa8a6eeb@suse.cz> (raw)
In-Reply-To: <0bbb2efbdc2ac2af2f6d73679cbb0811544d0647.1737929364.git.lorenzo.stoakes@oracle.com>
On 1/27/25 16:50, Lorenzo Stoakes wrote:
> --- a/mm/vma.h
> +++ b/mm/vma.h
> @@ -67,6 +67,16 @@ enum vma_merge_flags {
> * at the gap.
> */
> VMG_FLAG_JUST_EXPAND = 1 << 0,
> + /*
> + * Internal flag used during the merge operation to indicate we will
> + * remove vmg->middle.
> + */
> + __VMG_FLAG_REMOVE_MIDDLE = 1 << 1,
> + /*
> + * Internal flag used during the merge operationr to indicate we will
> + * remove vmg->next.
> + */
> + __VMG_FLAG_REMOVE_NEXT = 1 << 2,
> };
Hm this is actually kinda weird? It's an enum, but the values of it are
defined as different bits. And then struct vma_merge_struct has a "enum
vma_merge_flags merge_flags;" but we don't store to it a single "enum
vma_merge_flags" value defined above, but a combination of those. Is that
even legal to do in C?
AFAIK the more common pattern is enum that has normal incremental values
that are used for the shifts.
But I don't think we need all of this at all here? Just have bitfields in
struct vma_merge_struct?
bool just_expand : 1;
bool remove_middle : 1;
...
> /*
> diff --git a/tools/testing/vma/vma.c b/tools/testing/vma/vma.c
> index 3c0572120e94..8cce67237d86 100644
> --- a/tools/testing/vma/vma.c
> +++ b/tools/testing/vma/vma.c
> @@ -154,6 +154,9 @@ static void vmg_set_range(struct vma_merge_struct *vmg, unsigned long start,
> vmg->end = end;
> vmg->pgoff = pgoff;
> vmg->flags = flags;
> +
> + vmg->merge_flags = VMG_FLAG_DEFAULT;
> + vmg->target = NULL;
> }
>
> /*
next prev parent reply other threads:[~2025-01-28 15:45 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-01-27 15:50 [PATCH 0/5] mm: further simplify VMA merge operation Lorenzo Stoakes
2025-01-27 15:50 ` [PATCH 1/5] mm: simplify vma merge structure and expand comments Lorenzo Stoakes
2025-01-28 11:38 ` Vlastimil Babka
2025-01-28 14:05 ` Lorenzo Stoakes
2025-01-27 15:50 ` [PATCH 2/5] mm: further refactor commit_merge() Lorenzo Stoakes
2025-01-28 15:05 ` Vlastimil Babka
2025-01-28 15:45 ` Vlastimil Babka [this message]
2025-01-28 16:07 ` Lorenzo Stoakes
2025-01-28 16:42 ` Lorenzo Stoakes
2025-01-27 15:50 ` [PATCH 3/5] mm: eliminate adj_start parameter from commit_merge() Lorenzo Stoakes
2025-01-29 14:13 ` Vlastimil Babka
2025-01-29 14:19 ` Lorenzo Stoakes
2025-01-27 15:50 ` [PATCH 4/5] mm: make vmg->target consistent and further simplify commit_merge() Lorenzo Stoakes
2025-01-29 14:45 ` Vlastimil Babka
2025-01-29 14:51 ` Lorenzo Stoakes
2025-01-29 15:19 ` Vlastimil Babka
2025-01-29 15:30 ` Lorenzo Stoakes
2025-01-27 15:50 ` [PATCH 5/5] mm: completely abstract unnecessary adj_start calculation Lorenzo Stoakes
2025-01-27 18:50 ` kernel test robot
2025-01-27 18:56 ` Lorenzo Stoakes
2025-01-27 19:58 ` Lorenzo Stoakes
2025-01-27 20:13 ` kernel test robot
2025-01-27 20:35 ` kernel test robot
2025-01-28 7:54 ` kernel test robot
2025-01-29 15:42 ` Vlastimil Babka
2025-01-29 16:19 ` Lorenzo Stoakes
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=09484ff8-1b0c-4101-a793-e869aa8a6eeb@suse.cz \
--to=vbabka@suse.cz \
--cc=Liam.Howlett@oracle.com \
--cc=akpm@linux-foundation.org \
--cc=jannh@google.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=lorenzo.stoakes@oracle.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