LKML Archive on lore.kernel.org help / color / mirror / Atom feed
From: Muchun Song <songmuchun@bytedance.com> To: Barry Song <21cnbao@gmail.com> Cc: Mike Kravetz <mike.kravetz@oracle.com>, Andrew Morton <akpm@linux-foundation.org>, Oscar Salvador <osalvador@suse.de>, Michal Hocko <mhocko@suse.com>, Barry Song <song.bao.hua@hisilicon.com>, David Hildenbrand <david@redhat.com>, Chen Huang <chenhuang5@huawei.com>, "Bodeddula, Balasubramaniam" <bodeddub@amazon.com>, Jonathan Corbet <corbet@lwn.net>, Matthew Wilcox <willy@infradead.org>, Xiongchun duan <duanxiongchun@bytedance.com>, fam.zheng@bytedance.com, Muchun Song <smuchun@gmail.com>, Qi Zheng <zhengqi.arch@bytedance.com>, linux-doc@vger.kernel.org, LKML <linux-kernel@vger.kernel.org>, Linux-MM <linux-mm@kvack.org> Subject: Re: [PATCH RESEND v2 4/4] selftests: vm: add a hugetlb test case Date: Tue, 21 Sep 2021 21:18:43 +0800 [thread overview] Message-ID: <CAMZfGtVHriw5jXGJDOCr2pxHmB5SPVPto8yWkZBDmjSw8dcVEQ@mail.gmail.com> (raw) In-Reply-To: <CAGsJ_4zDKVkXf60d4ZPZjFJBN5L8wR1_57D_EUEzGZWcYhxn=A@mail.gmail.com> On Tue, Sep 21, 2021 at 8:29 PM Barry Song <21cnbao@gmail.com> wrote: > > On Tue, Sep 21, 2021 at 2:26 AM Muchun Song <songmuchun@bytedance.com> wrote: > > > > On Sat, Sep 18, 2021 at 1:20 PM Barry Song <21cnbao@gmail.com> wrote: > > > > > > On Sat, Sep 18, 2021 at 12:08 AM Muchun Song <songmuchun@bytedance.com> wrote: > > > > > > > > Since the head vmemmap page frame associated with each HugeTLB page is > > > > reused, we should hide the PG_head flag of tail struct page from the > > > > user. Add a tese case to check whether it is work properly. > > > > > > > > > > TBH, I am a bit confused. I was thinking about some kernel unit tests to make > > > sure those kernel APIs touched by this patchset are still working as before. > > > This userspace test, while certainly useful for checking the content of page > > > frames as expected, doesn't directly prove things haven't changed. > > > > > > In patch 1/4, a couple of APIs have the fixup for the fake head issue. > > > Do you think a test like the below would be more sensible? > > > 1. alloc 2MB hugeTLB > > > > It is done in main(). > > > > > 2. get each page frame > > > 3. apply those APIs in each page frame > > > 4. Those APIs work completely the same as before. > > > > Reading the flags of a page by /proc/kpageflags is done > > in stable_page_flags(), which has invoked PageHead(), > > PageTail(), PageCompound() and compound_head(). > > If those APIs work properly, the head page must have > > 15 and 17 bits set. And tail pages must have 16 and 17 > > bits set but 15 unset. > > > > So I think check_page_flags() has done the step 2 to 4. > > What do you think? > > yes. Thanks for your explanation. thereby, I think we just need some doc > here to explain what it is checking. something like > /* > * pages other than the first page must be tail and shouldn't be head; > * this also verifies kernel has correctly set the fake page_head to tail > * while hugetlb_free_vmemmap is enabled > */ Got it. Will do. Thanks. > + for (i = 1; i < MAP_LENGTH / PAGE_SIZE; i++) { > + read(fd, &pageflags, sizeof(pageflags)); > + if ((pageflags & TAIL_PAGE_FLAGS) != TAIL_PAGE_FLAGS || > + (pageflags & HEAD_PAGE_FLAGS) == HEAD_PAGE_FLAGS) { > + close(fd); > + printf("Tail page flags (%lx) is invalid\n", pageflags); > + return -1; > + } > + } > > > > Thanks. > > Thanks > barry
prev parent reply other threads:[~2021-09-21 13:19 UTC|newest] Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top 2021-09-17 3:48 [PATCH RESEND v2 0/4] Free the 2nd vmemmap page associated with each HugeTLB page Muchun Song 2021-09-17 3:48 ` [PATCH RESEND v2 1/4] mm: hugetlb: free " Muchun Song 2021-09-18 4:38 ` Barry Song 2021-09-18 10:06 ` Muchun Song 2021-09-21 6:43 ` Muchun Song 2021-09-21 10:22 ` Muchun Song 2021-09-21 0:11 ` Barry Song 2021-09-21 13:46 ` Muchun Song 2021-09-21 20:43 ` Barry Song 2021-09-22 2:38 ` Muchun Song 2021-09-22 7:36 ` Barry Song 2021-09-17 3:48 ` [PATCH RESEND v2 2/4] mm: hugetlb: replace hugetlb_free_vmemmap_enabled with a static_key Muchun Song 2021-09-18 4:55 ` Barry Song 2021-09-18 10:30 ` Muchun Song 2021-09-18 11:14 ` Barry Song 2021-09-18 11:47 ` Muchun Song 2021-09-18 12:27 ` Barry Song 2021-09-17 3:48 ` [PATCH RESEND v2 3/4] mm: sparsemem: use page table lock to protect kernel pmd operations Muchun Song 2021-09-18 5:06 ` Barry Song 2021-09-18 10:51 ` Muchun Song 2021-09-18 11:01 ` Barry Song 2021-09-17 3:48 ` [PATCH RESEND v2 4/4] selftests: vm: add a hugetlb test case Muchun Song 2021-09-18 5:20 ` Barry Song 2021-09-20 14:26 ` Muchun Song 2021-09-21 0:28 ` Barry Song 2021-09-21 13:18 ` Muchun Song [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=CAMZfGtVHriw5jXGJDOCr2pxHmB5SPVPto8yWkZBDmjSw8dcVEQ@mail.gmail.com \ --to=songmuchun@bytedance.com \ --cc=21cnbao@gmail.com \ --cc=akpm@linux-foundation.org \ --cc=bodeddub@amazon.com \ --cc=chenhuang5@huawei.com \ --cc=corbet@lwn.net \ --cc=david@redhat.com \ --cc=duanxiongchun@bytedance.com \ --cc=fam.zheng@bytedance.com \ --cc=linux-doc@vger.kernel.org \ --cc=linux-kernel@vger.kernel.org \ --cc=linux-mm@kvack.org \ --cc=mhocko@suse.com \ --cc=mike.kravetz@oracle.com \ --cc=osalvador@suse.de \ --cc=smuchun@gmail.com \ --cc=song.bao.hua@hisilicon.com \ --cc=willy@infradead.org \ --cc=zhengqi.arch@bytedance.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: linkBe 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; as well as URLs for NNTP newsgroup(s).