From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 14D68C3600C for ; Tue, 8 Apr 2025 08:11:41 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id D52BB6B000C; Tue, 8 Apr 2025 04:11:39 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id D00316B000D; Tue, 8 Apr 2025 04:11:39 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id BF2236B000E; Tue, 8 Apr 2025 04:11:39 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id 9C3CD6B000C for ; Tue, 8 Apr 2025 04:11:39 -0400 (EDT) Received: from smtpin04.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id C23AD5665D for ; Tue, 8 Apr 2025 08:11:40 +0000 (UTC) X-FDA: 83310157560.04.B7ED4E6 Received: from out30-98.freemail.mail.aliyun.com (out30-98.freemail.mail.aliyun.com [115.124.30.98]) by imf13.hostedemail.com (Postfix) with ESMTP id 3C1E12000A for ; Tue, 8 Apr 2025 08:11:37 +0000 (UTC) Authentication-Results: imf13.hostedemail.com; dkim=pass header.d=linux.alibaba.com header.s=default header.b=m+Ih4YFQ; dmarc=pass (policy=none) header.from=linux.alibaba.com; spf=pass (imf13.hostedemail.com: domain of baolin.wang@linux.alibaba.com designates 115.124.30.98 as permitted sender) smtp.mailfrom=baolin.wang@linux.alibaba.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1744099899; a=rsa-sha256; cv=none; b=FE1npDr7Il9kuf6kjVHtATfH1T41JXfLWDaAPwLHlV6cYyhNLAfxJY5OBYsj803/6ekFRO MSdb0sUoOli+DClv0o3BQvgQxIfJTiSwVZEKLondPCM3POsxHFi2w1HUvwSc+kx2z2wYHP pRQMN2Ujd+YjTpoeiVyXLV1U8Z03oT4= ARC-Authentication-Results: i=1; imf13.hostedemail.com; dkim=pass header.d=linux.alibaba.com header.s=default header.b=m+Ih4YFQ; dmarc=pass (policy=none) header.from=linux.alibaba.com; spf=pass (imf13.hostedemail.com: domain of baolin.wang@linux.alibaba.com designates 115.124.30.98 as permitted sender) smtp.mailfrom=baolin.wang@linux.alibaba.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1744099899; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=9h2K4oXsYeaw5f4qdfa43kBcn/+mZo5xYqKfvGWE2pU=; b=Tg+MfMoVUdfx7wliJiyufTyk8s7z5kFmtEo8iNYEZcNinHY5VRQ4pHoDwPY2IpdNZSWje8 X/JVxpntAJTX+lc/UkKtrMmDbOMznv6ojj0ybN/KxbgwH0K2qI1Vtl3ANYdRFFqohdVNU4 r97/jmXAf0GzBiSCVrz1roB9vD1D8xg= DKIM-Signature:v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.alibaba.com; s=default; t=1744099895; h=Message-ID:Date:MIME-Version:Subject:To:From:Content-Type; bh=9h2K4oXsYeaw5f4qdfa43kBcn/+mZo5xYqKfvGWE2pU=; b=m+Ih4YFQkpv49wgEukx2ToD17i8+Z/31WOGV5oZBkR5KtjEjpXzS3zdazb2RRNacfokNuXsEJagjxoSOFVz/XU3X32rS1y8HDbSQmhjRBrgE2ERfVjRd8IbSdWqUnbM6Qmsr++PV3wWMZF6CJyvg8d6DW84jTIpR/5HwvQjbros= Received: from 30.74.144.107(mailfrom:baolin.wang@linux.alibaba.com fp:SMTPD_---0WWEMSww_1744099893 cluster:ay36) by smtp.aliyun-inc.com; Tue, 08 Apr 2025 16:11:34 +0800 Message-ID: Date: Tue, 8 Apr 2025 16:11:33 +0800 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v2] selftests: mincore: fix tmpfs mincore test failure To: David Hildenbrand , akpm@linux-foundation.org, hughd@google.com Cc: willy@infradead.org, 21cnbao@gmail.com, ryan.roberts@arm.com, ziy@nvidia.com, linux-mm@kvack.org, linux-kernel@vger.kernel.org References: <9a00856cc6a8b4e46f4ab8b1af11ce5fc1a31851.1744025467.git.baolin.wang@linux.alibaba.com> <61e36a73-2c8c-4897-9ba5-3b2d59f57b5d@redhat.com> From: Baolin Wang In-Reply-To: <61e36a73-2c8c-4897-9ba5-3b2d59f57b5d@redhat.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 3C1E12000A X-Stat-Signature: 6nbk1mzf1ffthqkih4k7fb8sswygw51q X-Rspam-User: X-Rspamd-Server: rspam06 X-HE-Tag: 1744099897-365901 X-HE-Meta: U2FsdGVkX19C+lgARmIzADp3CNdKEC2wEM823SrZSzD+0IaWOQQ0UrjOjK9Zp16iTVNEvFb1OCoER2EmmbI83hM9a7BVz3lxhsofvJPXIYsEc+BNQLD2c39IwwliVzN62coApiyDs3Th0hCd87nalFhC6MhFKLHm9Orz0Ge+eWu9C/82bJbXNtEjJi4jSQFIVKTNL34dLB/tj+xvUKoHH8nX0aU6PdJKQ88MAmKPgYELsGDGUzRahGAOEceALPmn+hh7DpKnnyHEsFgKWWSvw6jgDy71e2Ggrs+OhhX9+a2AD6zFVicPGdr3u8tWAsSM4LsBn1wC2HtLCahE8//izqlMTBMb+N09JdNZaBW+cVkYF8WSXlCvCqBQYIlUlp4hM2EsKdXHlm48v3lbcy0QoLdsSSEubbzwZ+bsF0OEcOZoX74wq3tOR6qlekL0gMOjO/pqIThU1efs3GAYZFhzohKdsfuUZ/iF1/UaHZhIXVx+Cswvi3OPy0a4LUfLgrKDjyQ8oEn+C2HnMgiVLwpjR3yD1RQxexuVQJHFtiNoR8goBW8hWFbmV4nauRS9bNg2GzlPM9Z0Jr/OhAIcMNx+pp37uXDUtF/JQRo0Z68mYcU84de7y/HP10ODphncqLlLEjXuV6IBbWTugOX0Um3CU5QIBACvSMk39Y6gq9zpSX9yv5POGTxIvpK6fMfc18Iw49L7g6gW8pinehi61rOsmKnJn0ACxgraGFMlGmF3jMX4Vss6GyW/7szMDIlAewZUKdG0ymWnpmPSQmAhzCPLMVE59gTKV+32djJiiD3+fbvquEFR8xrpblCgRhkKFfTTi4pBt/k660MT6F5ysvB71TwjTDnvDTFwxeT3/Y1XAWVlsVYeQfmWYhlbIludEvQGL2uwnaJgYmn6O4pK3mlURSNUvmAWVUP0T8O53six3qFAr+1mj6zlhK0cFKVNMbFi8yITi5+a9gSBebFfRog /dTgvj6b c6wHz67EXvLcV3ETZVeTYGGhMIr1swE6XcoGnU1s2H1cds4VfGGg/Ih0+ddniMBcEc/WWDxj+BNsbwvOXr15po8gcl554qVT1CCgd2s3y3k3NohXLc/uKEwJV2A6vWjzWBaOLobWq7cFxZM+lQOjOIBx/BpD+ob/pOBlrT1DFTvgwHD0hIM2Q4TAb8LkSJu2MLv5xOJAcyCFM5kkfO8V9P02XNU1Sf477y67BlG0e3oDW1lAnVgSJCvKCzHQeV4h6HXKEk3HQ1UPcgQje8m5NNUn/94r13pe+xtefpvs7CISEim5K7quiKgwqOUr1G5dS5gFf X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: On 2025/4/7 23:04, David Hildenbrand wrote: > On 07.04.25 13:31, Baolin Wang wrote: >> When running mincore test cases, I encountered the following failures: >> >> " >> mincore_selftest.c:359:check_tmpfs_mmap:Expected ra_pages (511) == 0 (0) >> mincore_selftest.c:360:check_tmpfs_mmap:Read-ahead pages found in memory >> check_tmpfs_mmap: Test terminated by assertion >>            FAIL  global.check_tmpfs_mmap >> not ok 5 global.check_tmpfs_mmap >> FAILED: 4 / 5 tests passed >> " >> >> The reason for the test case failure is that my system automatically >> enabled >> tmpfs large folio allocation by adding the >> 'transparent_hugepage_tmpfs=always' >> cmdline. However, the test case still expects the tmpfs mounted on >> /dev/shm to >> allocate small folios, which leads to assertion failures when >> verifying readahead >> pages. >> >> As discussed with David, there's no reason to continue checking the >> readahead >> logic for tmpfs. Drop it to fix this issue. >> > > BTW, should we add a Fixes: ? Could only be tmpfs support that changed > the behavior but didn't fixup the test case. I was hesitant about whether a Fixes tag is needed, because this issue can be traced back to the earliest patch set that added THP support to tmpfs. However, the test issue wasn't exposed because the 'huge=' parameter wasn't included when mounting /dev/shm. After the cmdline 'transparent_hugepage_tmpfs' was added for tmpfs, the issue is exposed easily. So I am inclined to add a Fixes tag for the patch added the 'transparent_hugepage_tmpfs' cmdline. Fixes: d635ccdb435c ("mm: shmem: add a kernel command line to change the default huge policy for tmpfs") >> Signed-off-by: Baolin Wang >> --- >> Changes from v1: >>   - Drop the readahead logic check, per David. >> --- >>   .../testing/selftests/mincore/mincore_selftest.c | 16 ++-------------- >>   1 file changed, 2 insertions(+), 14 deletions(-) >> >> diff --git a/tools/testing/selftests/mincore/mincore_selftest.c >> b/tools/testing/selftests/mincore/mincore_selftest.c >> index e949a43a6145..0fd4b00bd345 100644 >> --- a/tools/testing/selftests/mincore/mincore_selftest.c >> +++ b/tools/testing/selftests/mincore/mincore_selftest.c >> @@ -286,8 +286,7 @@ TEST(check_file_mmap) >>   /* >>    * Test mincore() behavior on a page backed by a tmpfs file.  This test >> - * performs the same steps as the previous one. However, we don't expect >> - * any readahead in this case. >> + * performs the same steps as the previous one. >>    */ >>   TEST(check_tmpfs_mmap) >>   { >> @@ -298,7 +297,6 @@ TEST(check_tmpfs_mmap) >>       int page_size; >>       int fd; >>       int i; >> -    int ra_pages = 0; >>       page_size = sysconf(_SC_PAGESIZE); >>       vec_size = FILE_SIZE / page_size; >> @@ -341,8 +339,7 @@ TEST(check_tmpfs_mmap) >>       } >>       /* >> -     * Touch a page in the middle of the mapping. We expect only >> -     * that page to be fetched into memory. >> +     * Touch a page in the middle of the mapping. >>        */ >>       addr[FILE_SIZE / 2] = 1; >>       retval = mincore(addr, FILE_SIZE, vec); >> @@ -351,15 +348,6 @@ TEST(check_tmpfs_mmap) >>           TH_LOG("Page not found in memory after use"); >>       } >> -    i = FILE_SIZE / 2 / page_size + 1; >> -    while (i < vec_size && vec[i]) { >> -        ra_pages++; >> -        i++; >> -    } >> -    ASSERT_EQ(ra_pages, 0) { >> -        TH_LOG("Read-ahead pages found in memory"); >> -    } >> - >>       munmap(addr, FILE_SIZE); >>       close(fd); >>       free(vec); > > Acked-by: David Hildenbrand Thanks.