From patchwork Thu Nov 16 20:15:47 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Xu X-Patchwork-Id: 13458261 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 50171C47071 for ; Thu, 16 Nov 2023 20:16:01 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 8EA656B0498; Thu, 16 Nov 2023 15:15:59 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 89AAF6B049B; Thu, 16 Nov 2023 15:15:59 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 6ED4F6B049C; Thu, 16 Nov 2023 15:15:59 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id 56EEF6B0498 for ; Thu, 16 Nov 2023 15:15:59 -0500 (EST) Received: from smtpin09.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id 334AF808B0 for ; Thu, 16 Nov 2023 20:15:59 +0000 (UTC) X-FDA: 81464923638.09.A39DF68 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by imf05.hostedemail.com (Postfix) with ESMTP id 15244100012 for ; Thu, 16 Nov 2023 20:15:56 +0000 (UTC) Authentication-Results: imf05.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=LeHVayb9; dmarc=pass (policy=none) header.from=redhat.com; spf=pass (imf05.hostedemail.com: domain of peterx@redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=peterx@redhat.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1700165757; 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=QIfhkJ5q+MuBUNqDP7+llj85JgVyRPSym9vvMGwkwM8=; b=T//XVA/M0sB7isOnIg/O6jYsafVe5Lna2cXkWbZZmWYnk00VqArAIExSpIzU9bOD6eLP67 7Q0Tc70sAyL+4FYC4abCEPhvNjRyOhW32DS0dsDwhDOYpF+oH9xqaKmBFKrAUQOfpoNkLL LT3XVLSMABaS5QFnFFY8vfDRxHOXr4M= ARC-Authentication-Results: i=1; imf05.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=LeHVayb9; dmarc=pass (policy=none) header.from=redhat.com; spf=pass (imf05.hostedemail.com: domain of peterx@redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=peterx@redhat.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1700165757; a=rsa-sha256; cv=none; b=df9AO4n2YJ9r5BkGR62zNO0+pC2ZK/KgSsddiuYixKwEN3kzupl4kELZrmwgF0FJVQfESM pmMYsi2Ozz57S9m7Z5KolKyQaqjMbKox0y+1WnZrziGyIsDaWL9xgx+NgbOxWdmwos5Joz yy2enqDw0Z4uQ1hXxwXlAG2+Ror0ATU= 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-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=QIfhkJ5q+MuBUNqDP7+llj85JgVyRPSym9vvMGwkwM8=; b=LeHVayb9kAEAl1wd5gETRffB/czDNtQCSPprKnsZNcjAvUck8+A07o1aP8guqgBhMoqz4N okSCN25t3cIiuj0470wLkrFR6bNlHXwdYAx9IgNX5b/HgLGdZbSF30Bsl8HupX2CtRN05G l6UHLkv1NhB5WEyXe2tCn10j3sjsFag= Received: from mail-qk1-f199.google.com (mail-qk1-f199.google.com [209.85.222.199]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-561-1dhizfHMOL-uPX3kJHXbVg-1; Thu, 16 Nov 2023 15:15:55 -0500 X-MC-Unique: 1dhizfHMOL-uPX3kJHXbVg-1 Received: by mail-qk1-f199.google.com with SMTP id af79cd13be357-77a02ceef95so18076785a.0 for ; Thu, 16 Nov 2023 12:15:55 -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=ho+BLWGnh+57zkV8RLcEc8MDthhSCcLHNaKyT144aUrJCifYNk4Mzu4THccXzMyo1L deFuVzYn7XKWj3gkgk+dbCWh9ztk4D+47PrAeKu1RQA5CUBxkzobivk+x/EG0ReU5bw/ lB9lSD4IUsXGHHeBWFoszNhqfp9UXhUnPoLvy9J4GY2eVVGetrVTBI09Q4WfoMP69ono d4LO7eO1YoDh4awUvelTiWwq6yWhvoLpn6lo8CyhCK9/tcrQd1yLkQ6wXjB/PhS4+u2s 22Wi0hv6/vhDPxto4efwMSQbhIvpeYMIt/XF/3O9FwT5hedAAGLEovn9vvimOJYi4UuR 8a8A== X-Gm-Message-State: AOJu0YxioQ7Vkj0CgtXJsC114FgYUsS9UHsULmIshCsdsP27/jK6F/vl bYZvi5MD9rFc3z1ibHR6C/6Fqz2qnSmv0a1Kz5p2K3tLAXsHOwD7M+1Qh7rJDjc4BuxgTU99+m6 NnTGOi0fN9SuW12xMQD9Zlv15ZppqqhriGFaYlzcU7k571RvIgcKopynOKM9L30gml5L1 X-Received: by 2002:a05:620a:460f:b0:777:7178:ebf0 with SMTP id br15-20020a05620a460f00b007777178ebf0mr10983535qkb.5.1700165754445; Thu, 16 Nov 2023 12:15:54 -0800 (PST) X-Google-Smtp-Source: AGHT+IFn7WTMLEwrbmDqREYqOP32v0nHbLxAxhRbfg6zZ9i1WFQBXOXwxoGfistYIkGysffqZC/jBw== 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 To: linux-mm@kvack.org, linux-kernel@vger.kernel.org Cc: peterx@redhat.com, Muhammad Usama Anjum , Andrew Morton , David Hildenbrand , Andrei Vagin 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 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-Rspam-User: X-Rspamd-Server: rspam12 X-Rspamd-Queue-Id: 15244100012 X-Stat-Signature: hxei38i4y8waftybpgcj9brkaspe1xe8 X-HE-Tag: 1700165756-759408 X-HE-Meta: U2FsdGVkX1/tskDrmAOOpQoR48jisEuphzIcHsk10zzAG/UiJTw3lvCz22ErnkCzvvcEXFrzEotAA0NUZnU4Km11sq7HMtZ6nAQMRXokiQuvttPomnAh1A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0k2BzqyX3ppv+BLoPjvwHmvnSOrxVV49CdLfOJHfBNhxt//BZWB4TZkZF2jWkchwIfuSa7tiEMCa0rqutOiE/6OzGUViCnpL6HguZlWf/t7xq9tAmZ6DzR+qwNgkUO3CBJa5uF+pcCsXVVSKgwqq4/Hr2JHf17rq8yyNCdBuEkBf9LmSdnVGW4D9ABtkBEoeissKahGYJ4hJS3ohJWwzOhA== 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: __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 Reviewed-by: David Hildenbrand --- 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())