mirror of
https://github.com/torvalds/linux.git
synced 2025-12-07 20:06:24 +00:00
tools/testing/vma: eliminate dependency on vma->__vm_flags
The userland VMA test code relied on an internal implementation detail - the existence of vma->__vm_flags to directly access VMA flags. There is no need to do so when we have the vm_flags_*() helper functions available. This is ugly, but also a subsequent commit will eliminate this field altogether so this will shortly become broken. This patch has us utilise the helper functions instead. Link: https://lkml.kernel.org/r/6275c53a6bb20743edcbe92d3e130183b47d18d0.1764064557.git.lorenzo.stoakes@oracle.com Signed-off-by: Lorenzo Stoakes <lorenzo.stoakes@oracle.com> Acked-by: Vlastimil Babka <vbabka@suse.cz> Acked-by: Pedro Falcato <pfalcato@suse.de> Acked-by: Alice Ryhl <aliceryhl@google.com> [rust] Cc: Alex Gaynor <alex.gaynor@gmail.com> Cc: Alistair Popple <apopple@nvidia.com> Cc: Andreas Hindborg <a.hindborg@kernel.org> Cc: Axel Rasmussen <axelrasmussen@google.com> Cc: Baolin Wang <baolin.wang@linux.alibaba.com> Cc: Baoquan He <bhe@redhat.com> Cc: Barry Song <baohua@kernel.org> Cc: Ben Segall <bsegall@google.com> Cc: Björn Roy Baron <bjorn3_gh@protonmail.com> Cc: Boqun Feng <boqun.feng@gmail.com> Cc: Byungchul Park <byungchul@sk.com> Cc: Chengming Zhou <chengming.zhou@linux.dev> Cc: Chris Li <chrisl@kernel.org> Cc: Danilo Krummrich <dakr@kernel.org> Cc: David Hildenbrand <david@redhat.com> Cc: David Rientjes <rientjes@google.com> Cc: Dev Jain <dev.jain@arm.com> Cc: Dietmar Eggemann <dietmar.eggemann@arm.com> Cc: Gary Guo <gary@garyguo.net> Cc: Gregory Price <gourry@gourry.net> Cc: "Huang, Ying" <ying.huang@linux.alibaba.com> Cc: Ingo Molnar <mingo@redhat.com> Cc: Jann Horn <jannh@google.com> Cc: Jason Gunthorpe <jgg@ziepe.ca> Cc: Johannes Weiner <hannes@cmpxchg.org> Cc: John Hubbard <jhubbard@nvidia.com> Cc: Joshua Hahn <joshua.hahnjy@gmail.com> Cc: Juri Lelli <juri.lelli@redhat.com> Cc: Kairui Song <kasong@tencent.com> Cc: Kees Cook <kees@kernel.org> Cc: Kemeng Shi <shikemeng@huaweicloud.com> Cc: Lance Yang <lance.yang@linux.dev> Cc: Leon Romanovsky <leon@kernel.org> Cc: Liam Howlett <liam.howlett@oracle.com> Cc: Mathew Brost <matthew.brost@intel.com> Cc: Matthew Wilcox (Oracle) <willy@infradead.org> Cc: Mel Gorman <mgorman <mgorman@suse.de> Cc: Michal Hocko <mhocko@suse.com> Cc: Miguel Ojeda <ojeda@kernel.org> Cc: Mike Rapoport <rppt@kernel.org> Cc: Muchun Song <muchun.song@linux.dev> Cc: Nhat Pham <nphamcs@gmail.com> Cc: Nico Pache <npache@redhat.com> Cc: Oscar Salvador <osalvador@suse.de> Cc: Peter Xu <peterx@redhat.com> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Qi Zheng <zhengqi.arch@bytedance.com> Cc: Rakie Kim <rakie.kim@sk.com> Cc: Rik van Riel <riel@surriel.com> Cc: Ryan Roberts <ryan.roberts@arm.com> Cc: Shakeel Butt <shakeel.butt@linux.dev> Cc: Steven Rostedt <rostedt@goodmis.org> Cc: Suren Baghdasaryan <surenb@google.com> Cc: Trevor Gross <tmgross@umich.edu> Cc: Valentin Schneider <vschneid@redhat.com> Cc: Vincent Guittot <vincent.guittot@linaro.org> Cc: Wei Xu <weixugc@google.com> Cc: xu xin <xu.xin16@zte.com.cn> Cc: Yuanchu Xie <yuanchu@google.com> Cc: Zi Yan <ziy@nvidia.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
This commit is contained in:
committed by
Andrew Morton
parent
58eac97a8b
commit
4c613f518f
@@ -69,18 +69,18 @@ static struct vm_area_struct *alloc_vma(struct mm_struct *mm,
|
||||
pgoff_t pgoff,
|
||||
vm_flags_t vm_flags)
|
||||
{
|
||||
struct vm_area_struct *ret = vm_area_alloc(mm);
|
||||
struct vm_area_struct *vma = vm_area_alloc(mm);
|
||||
|
||||
if (ret == NULL)
|
||||
if (vma == NULL)
|
||||
return NULL;
|
||||
|
||||
ret->vm_start = start;
|
||||
ret->vm_end = end;
|
||||
ret->vm_pgoff = pgoff;
|
||||
ret->__vm_flags = vm_flags;
|
||||
vma_assert_detached(ret);
|
||||
vma->vm_start = start;
|
||||
vma->vm_end = end;
|
||||
vma->vm_pgoff = pgoff;
|
||||
vm_flags_reset(vma, vm_flags);
|
||||
vma_assert_detached(vma);
|
||||
|
||||
return ret;
|
||||
return vma;
|
||||
}
|
||||
|
||||
/* Helper function to allocate a VMA and link it to the tree. */
|
||||
@@ -714,7 +714,7 @@ static bool test_vma_merge_special_flags(void)
|
||||
for (i = 0; i < ARRAY_SIZE(special_flags); i++) {
|
||||
vm_flags_t special_flag = special_flags[i];
|
||||
|
||||
vma_left->__vm_flags = vm_flags | special_flag;
|
||||
vm_flags_reset(vma_left, vm_flags | special_flag);
|
||||
vmg.vm_flags = vm_flags | special_flag;
|
||||
vma = merge_new(&vmg);
|
||||
ASSERT_EQ(vma, NULL);
|
||||
@@ -736,7 +736,7 @@ static bool test_vma_merge_special_flags(void)
|
||||
for (i = 0; i < ARRAY_SIZE(special_flags); i++) {
|
||||
vm_flags_t special_flag = special_flags[i];
|
||||
|
||||
vma_left->__vm_flags = vm_flags | special_flag;
|
||||
vm_flags_reset(vma_left, vm_flags | special_flag);
|
||||
vmg.vm_flags = vm_flags | special_flag;
|
||||
vma = merge_existing(&vmg);
|
||||
ASSERT_EQ(vma, NULL);
|
||||
|
||||
Reference in New Issue
Block a user