Message ID | 20231116201547.536857-4-peterx@redhat.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:9910:0:b0:403:3b70:6f57 with SMTP id i16csp90481vqn; Thu, 16 Nov 2023 12:16:36 -0800 (PST) X-Google-Smtp-Source: AGHT+IHmIR8SDwIhkBG1PXvKra7o4pwcO8+C9qz9Xas+saU/TSJpqzXwGqtKKD2fR8d0eC7NthLN X-Received: by 2002:a05:6808:164d:b0:3ad:c476:9ad9 with SMTP id az13-20020a056808164d00b003adc4769ad9mr22113826oib.4.1700165796444; Thu, 16 Nov 2023 12:16:36 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700165796; cv=none; d=google.com; s=arc-20160816; b=mRhSVjH6y9hQfOq8eMqJSM12OQndnhVI0CCIqqkag/h2J8mEibTy3TFGtb63kziTbq fKP5VJVTDgE6sNLNIBf8WoukiY37MtpFlPg/oY5DfACdV8ktQMUkiyF1fYWuDYzJuUn0 CSXacfZ2cB8UAcgt6QocARZAntXkpzsBk8tE+Rftq9ubJYqO4qGzYJC5+viKhrFrIo3w Wo/vncM2xicYeCwmT9GJM07ZdADuPXAeSPMirZ6igTP5bi85s64SoEf7QZjrT+1a6tzI 0Sc0gkrEHMKrZYGymscwzKGwtSzAM65CEMgMFJD6J6ZXtlsYlXtni0h5WmprVmZ0uiQv Fakg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=QIfhkJ5q+MuBUNqDP7+llj85JgVyRPSym9vvMGwkwM8=; fh=ONBGb8POD0DAPCHfLkA/ec1VmXEVS74YC25GSOEo2kI=; b=VczI4BBS7rV46cMkn0fdNoCqp49qkd5HmirzYTXKpPWz3PcjNqBOOP9ui7AaZ+uep5 x/EHjlmAoInCsFUiJMdT3Arvly7P1lc93pqDlKRJhw/0VcUKRJeUTZ+pycEQxg8F2u51 vV3ZbjnEE1tV0iNBBEuKG0UVewwBEtD/6opCRVJpYEF6153Ipr1c5oPLWagB66UWjoev sWja8gQ3idfq+yv+ntfCdvSVUAI2GZJkl5ZevmC1cgspYNCj/WWdVsYneLY5SRkkVT1J rWSB6G43IXnzj+sgKGsDS6hQDidH+ETzi5KTs1HN94g76UNDkU/Rtk/A5g+aIZFiyD5a vlbw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=EMx+bDzk; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from agentk.vger.email (agentk.vger.email. [2620:137:e000::3:2]) by mx.google.com with ESMTPS id q14-20020a63e20e000000b0056f7f18bbfdsi193996pgh.632.2023.11.16.12.16.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 16 Nov 2023 12:16:36 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) client-ip=2620:137:e000::3:2; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=EMx+bDzk; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by agentk.vger.email (Postfix) with ESMTP id D2057808E578; Thu, 16 Nov 2023 12:16:29 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234138AbjKPUQI (ORCPT <rfc822;jaysivo@gmail.com> + 30 others); Thu, 16 Nov 2023 15:16:08 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59282 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231300AbjKPUP7 (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Thu, 16 Nov 2023 15:15:59 -0500 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E3B361AD for <linux-kernel@vger.kernel.org>; Thu, 16 Nov 2023 12:15:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1700165756; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=QIfhkJ5q+MuBUNqDP7+llj85JgVyRPSym9vvMGwkwM8=; b=EMx+bDzk8Nr6qdAyyHWiJIBCZsczcUAeVyoyfOnK7j09Dx0o3tGzSJJCquD6Cz1ihDUGAf JT0HHJwk4/AfoDhrwMAauPtQmzUsz8f5AgNWITHtHtSrFhFjXKJrugQ9C/1JawY77aYj1l AAVX7Yom9diVSfpqjEI3NswuF9l+ZL4= Received: from mail-qk1-f198.google.com (mail-qk1-f198.google.com [209.85.222.198]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-133-tfgHdjaBOQGR7f3JsXbUXQ-1; Thu, 16 Nov 2023 15:15:54 -0500 X-MC-Unique: tfgHdjaBOQGR7f3JsXbUXQ-1 Received: by mail-qk1-f198.google.com with SMTP id af79cd13be357-77a02ceef95so18076385a.0 for <linux-kernel@vger.kernel.org>; Thu, 16 Nov 2023 12:15:54 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1700165754; x=1700770554; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=QIfhkJ5q+MuBUNqDP7+llj85JgVyRPSym9vvMGwkwM8=; b=njd9H8AZLVpERM9UglB7S0bIz6/cg74E57X9V/jQUdQnJ6k5UM/BtceOhsJG4NiADj FXuKG04svL3kjY+hmneJ2uqCfxrfFpAECoTfhD4nubOi0CdtGyGn6dQnbXJH7B+TFlxB 93tXymbKZyZWGY082sJWfLR6XOjDjg5LVxN6SyG2LqLi7pO4CKVEZ94hp6EoTaCkxkhh PHj7aPnBVZEwt0r7WOp3Y0pt60lmOwXi+RWcgd3vNSMFzDSzv2Io2vOEibt8IqXh9E+X oetBNT+htpe/A1dDBTzh53/rgT82MmxGPkBsYmi79aqshNDARSFCbDDi3P7bdZ0Btbcp 9ZJg== X-Gm-Message-State: AOJu0Yy7Eci+Q4VuIpONnnc9mZT4ykYTUSaGJ/6Pndh5jeLszd49mUQS lobd2RIzJ9P9dIv1kkXm50wKRUSvaP8WKK9jB/z5Ura81DeljrN2M+BZxpY/jlO8zuxK8kqg4n7 vlapXNR78kzUonyByvZnlpdB4 X-Received: by 2002:a05:620a:460f:b0:777:7178:ebf0 with SMTP id br15-20020a05620a460f00b007777178ebf0mr10983525qkb.5.1700165754345; Thu, 16 Nov 2023 12:15:54 -0800 (PST) X-Received: by 2002:a05:620a:460f:b0:777:7178:ebf0 with SMTP id br15-20020a05620a460f00b007777178ebf0mr10983511qkb.5.1700165754044; Thu, 16 Nov 2023 12:15:54 -0800 (PST) Received: from x1n.redhat.com (cpe688f2e2cb7c3-cm688f2e2cb7c0.cpe.net.cable.rogers.com. [99.254.121.117]) by smtp.gmail.com with ESMTPSA id b19-20020a05620a271300b007659935ce64sm65524qkp.71.2023.11.16.12.15.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 16 Nov 2023 12:15:53 -0800 (PST) From: Peter Xu <peterx@redhat.com> To: linux-mm@kvack.org, linux-kernel@vger.kernel.org Cc: peterx@redhat.com, Muhammad Usama Anjum <usama.anjum@collabora.com>, Andrew Morton <akpm@linux-foundation.org>, David Hildenbrand <david@redhat.com>, Andrei Vagin <avagin@gmail.com> Subject: [PATCH 3/3] mm/selftests: Fix pagemap_ioctl memory map test Date: Thu, 16 Nov 2023 15:15:47 -0500 Message-ID: <20231116201547.536857-4-peterx@redhat.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231116201547.536857-1-peterx@redhat.com> References: <20231116201547.536857-1-peterx@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.0 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on agentk.vger.email Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (agentk.vger.email [0.0.0.0]); Thu, 16 Nov 2023 12:16:29 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1782753050472333226 X-GMAIL-MSGID: 1782753050472333226 |
Series |
mm/pagemap: A few fixes to the recent PAGEMAP_SCAN
|
|
Commit Message
Peter Xu
Nov. 16, 2023, 8:15 p.m. UTC
__FILE__ is not guaranteed to exist in current dir. Replace that with
argv[0] for memory map test.
Fixes: 46fd75d4a3c9 ("selftests: mm: add pagemap ioctl tests")
Signed-off-by: Peter Xu <peterx@redhat.com>
---
tools/testing/selftests/mm/pagemap_ioctl.c | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
Comments
On 16.11.23 21:15, Peter Xu wrote: > __FILE__ is not guaranteed to exist in current dir. Replace that with > argv[0] for memory map test. > > Fixes: 46fd75d4a3c9 ("selftests: mm: add pagemap ioctl tests") > Signed-off-by: Peter Xu <peterx@redhat.com> > --- > tools/testing/selftests/mm/pagemap_ioctl.c | 9 ++++++--- > 1 file changed, 6 insertions(+), 3 deletions(-) > > diff --git a/tools/testing/selftests/mm/pagemap_ioctl.c b/tools/testing/selftests/mm/pagemap_ioctl.c > index befab43719ba..d59517ed3d48 100644 > --- a/tools/testing/selftests/mm/pagemap_ioctl.c > +++ b/tools/testing/selftests/mm/pagemap_ioctl.c > @@ -36,6 +36,7 @@ int pagemap_fd; > int uffd; > int page_size; > int hpage_size; > +const char *progname; > > #define LEN(region) ((region.end - region.start)/page_size) > > @@ -1149,11 +1150,11 @@ int sanity_tests(void) > munmap(mem, mem_size); > > /* 9. Memory mapped file */ > - fd = open(__FILE__, O_RDONLY); > + fd = open(progname, O_RDONLY); > if (fd < 0) > ksft_exit_fail_msg("%s Memory mapped file\n", __func__); > > - ret = stat(__FILE__, &sbuf); > + ret = stat(progname, &sbuf); > if (ret < 0) > ksft_exit_fail_msg("error %d %d %s\n", ret, errno, strerror(errno)); > > @@ -1472,12 +1473,14 @@ static void transact_test(int page_size) > extra_thread_faults); > } > > -int main(void) > +int main(int argc, char *argv[]) > { > int mem_size, shmid, buf_size, fd, i, ret; > char *mem, *map, *fmem; > struct stat sbuf; > > + progname = argv[0]; > + > ksft_print_header(); > > if (init_uffd()) Reviewed-by: David Hildenbrand <david@redhat.com>
diff --git a/tools/testing/selftests/mm/pagemap_ioctl.c b/tools/testing/selftests/mm/pagemap_ioctl.c index befab43719ba..d59517ed3d48 100644 --- a/tools/testing/selftests/mm/pagemap_ioctl.c +++ b/tools/testing/selftests/mm/pagemap_ioctl.c @@ -36,6 +36,7 @@ int pagemap_fd; int uffd; int page_size; int hpage_size; +const char *progname; #define LEN(region) ((region.end - region.start)/page_size) @@ -1149,11 +1150,11 @@ int sanity_tests(void) munmap(mem, mem_size); /* 9. Memory mapped file */ - fd = open(__FILE__, O_RDONLY); + fd = open(progname, O_RDONLY); if (fd < 0) ksft_exit_fail_msg("%s Memory mapped file\n", __func__); - ret = stat(__FILE__, &sbuf); + ret = stat(progname, &sbuf); if (ret < 0) ksft_exit_fail_msg("error %d %d %s\n", ret, errno, strerror(errno)); @@ -1472,12 +1473,14 @@ static void transact_test(int page_size) extra_thread_faults); } -int main(void) +int main(int argc, char *argv[]) { int mem_size, shmid, buf_size, fd, i, ret; char *mem, *map, *fmem; struct stat sbuf; + progname = argv[0]; + ksft_print_header(); if (init_uffd())