From patchwork Tue Sep 13 21:25:17 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zach O'Keefe X-Patchwork-Id: 12975394 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 3114AECAAD8 for ; Tue, 13 Sep 2022 21:26:02 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 5B2978D0001; Tue, 13 Sep 2022 17:26:01 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 5624C6B0073; Tue, 13 Sep 2022 17:26:01 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 429118D0001; Tue, 13 Sep 2022 17:26:01 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id 313AB6B0072 for ; Tue, 13 Sep 2022 17:26:01 -0400 (EDT) Received: from smtpin12.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id 03D1C160599 for ; Tue, 13 Sep 2022 21:25:46 +0000 (UTC) X-FDA: 79908344334.12.770A087 Received: from mail-pf1-f202.google.com (mail-pf1-f202.google.com [209.85.210.202]) by imf01.hostedemail.com (Postfix) with ESMTP id A5C6F40092 for ; Tue, 13 Sep 2022 21:25:46 +0000 (UTC) Received: by mail-pf1-f202.google.com with SMTP id q22-20020a62e116000000b005428fb66124so5037563pfh.16 for ; Tue, 13 Sep 2022 14:25:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=cc:to:from:subject:message-id:mime-version:date:from:to:cc:subject :date; bh=KcoIhHQ1hIA7NeFwYZr5VI+ycn+xjIZkbVq5ZV8tWWo=; b=BR28yQX4vby8NzXuFowRDt3RdUAQlbSc3eU2YPPTM2nKtb2wPnWlKg2QT/bR6iw4eY b5fwYxC15XjY4vLK+TacYOM1+4Ox2Y5ODtRWky5CVtDLGAO1S40VrCeESs89z7SVFUTn lCZHj3KrYhMCFmBAmLqxbilVMsnWZIa2/z8GZ6EL/LvzSkKKF51T0+yw0k0aqMpduVe5 GMyV0qFaGx4bziyerITjT1atJhBe+Y5fswIaYaLLoz1YJKTfj5xdoRH9TSoyrfyAgEzD DeZVbvoTFkp76mmy3ecDnZ21E8QAN42rz/0XsPgAkZ6to0j3wgdgRi8MM2SCSnmpmfc9 flxw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:from:subject:message-id:mime-version:date:x-gm-message-state :from:to:cc:subject:date; bh=KcoIhHQ1hIA7NeFwYZr5VI+ycn+xjIZkbVq5ZV8tWWo=; b=bcFFe+br/kATVYwsIEzYJi3IIXcC66Px15kmvvjb6Ko/6Jq1v6lbVFweU5K8R3WmeY rnwJpWT4AaIPsJKrTW2ZPhd7OSPAqx42EZdBdti9HDsiLXib7bpnJ+5o5tSJB03FXJNQ T9+Kc/3y7PeMEnQFE6CmOMNuYNNR6hTb0r2J9Oo3t1jzWSG0FQJGagte+QZ4Bx14iR0M wTK8HehTHNKDPhb8MahGdVLr1O3vz52pCW0cj0UFQq1U8E4QaK8IJtaX432tXFf9fH17 8QVsIgnF8IYe7GeI8STx1FvjA4slBUJIXaLbuBbr2cO7md/Ir509TIzWBeiEnL7gDQAe 91uw== X-Gm-Message-State: ACgBeo3ltLr5Ubfj+zFrZ3pTaWGb0Hgb9gexZFxCM5soJ/ccJmBFwQvK 9ER/hK//1/l7KtaarZr28+B9dBBkT9xz X-Google-Smtp-Source: AA6agR6itifYL2GJn4La04WwaxmZqhNGEErHFa4EYzfOhOIW9gaK9W/TUgLFZvfATG7jrGePUTtTrn6bUKdZ X-Received: from zokeefe3.c.googlers.com ([fda3:e722:ac3:cc00:7f:e700:c0a8:1b6]) (user=zokeefe job=sendgmr) by 2002:a63:1e4b:0:b0:439:1ca4:22f9 with SMTP id p11-20020a631e4b000000b004391ca422f9mr7590820pgm.588.1663104345487; Tue, 13 Sep 2022 14:25:45 -0700 (PDT) Date: Tue, 13 Sep 2022 14:25:17 -0700 Mime-Version: 1.0 X-Mailer: git-send-email 2.37.2.789.g6183377224-goog Message-ID: <20220913212517.3163701-1-zokeefe@google.com> Subject: [PATCH mm-unstable] selftests/vm: fix "add thp collapse file and tmpfs testing" for tmpfs From: "Zach O'Keefe" To: Andrew Morton Cc: linux-mm@kvack.org, "Zach O'Keefe" ARC-Authentication-Results: i=1; imf01.hostedemail.com; dkim=pass header.d=google.com header.s=20210112 header.b=BR28yQX4; spf=pass (imf01.hostedemail.com: domain of 3WfUgYwcKCOYhWSMMNMOWWOTM.KWUTQVcf-UUSdIKS.WZO@flex--zokeefe.bounces.google.com designates 209.85.210.202 as permitted sender) smtp.mailfrom=3WfUgYwcKCOYhWSMMNMOWWOTM.KWUTQVcf-UUSdIKS.WZO@flex--zokeefe.bounces.google.com; dmarc=pass (policy=reject) header.from=google.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1663104346; a=rsa-sha256; cv=none; b=nPTau6noN5C9glDrz2U3q0Xn07/CBZ5tDmchMuw1Ki3lbc8UqH1iXwyd0s8ckWJFs+F0MH ISdiMgCjlZYAmv00ojPjLrC0usH1W1rNiCt3ThK9UMdpHeOpR4iH0Bhr03aJjGR5U3+mMm CSgJLOuSNODnk1gWRULKzpMAy1nlENY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1663104346; 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:in-reply-to: references:dkim-signature; bh=KcoIhHQ1hIA7NeFwYZr5VI+ycn+xjIZkbVq5ZV8tWWo=; b=J48gKC06clA/H1Oj9Bw57f13GPOsPICIrP9Le+bC7bTul3HCppCjx19NrZz3Q18Wq/COYo nuw+Ox+dyDUURgiZ/RAoo71tNbHJCckUQ5ZDdvPy9t22zVFcLkUxgxP76i0eVAC8/iEPDV woc/YAE8b+TNtil3XYLyPb032hdO974= X-Rspam-User: Authentication-Results: imf01.hostedemail.com; dkim=pass header.d=google.com header.s=20210112 header.b=BR28yQX4; spf=pass (imf01.hostedemail.com: domain of 3WfUgYwcKCOYhWSMMNMOWWOTM.KWUTQVcf-UUSdIKS.WZO@flex--zokeefe.bounces.google.com designates 209.85.210.202 as permitted sender) smtp.mailfrom=3WfUgYwcKCOYhWSMMNMOWWOTM.KWUTQVcf-UUSdIKS.WZO@flex--zokeefe.bounces.google.com; dmarc=pass (policy=reject) header.from=google.com X-Rspamd-Server: rspam04 X-Stat-Signature: aieeqhptf164e9to4yuphsd4hfeu8z6c X-Rspamd-Queue-Id: A5C6F40092 X-HE-Tag: 1663104346-583586 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: In write_settings() and save_settings() we properly only read/write /sys/block//queue/read_ahead_kb if the test file is not backed by tmpfs. However, in get_finfo(), we unconditionally attempt to resolve the major/minor device pair and search for device interface, which we fail to do when the device is the null device (major 0), as is the case when stat(2)'ing a tmpfs-backed file. Only resolve path to queue/read_ahead_kb when dealing with non-tmpfs files. Fixes: 64b9fb1fa904 ("selftests/vm: add thp collapse file and tmpfs testing") Signed-off-by: Zach O'Keefe --- tools/testing/selftests/vm/khugepaged.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tools/testing/selftests/vm/khugepaged.c b/tools/testing/selftests/vm/khugepaged.c index 702f64b3aa08..ad46fdb57d78 100644 --- a/tools/testing/selftests/vm/khugepaged.c +++ b/tools/testing/selftests/vm/khugepaged.c @@ -453,6 +453,8 @@ static void get_finfo(const char *dir) exit(EXIT_FAILURE); } finfo.type = fs.f_type == TMPFS_MAGIC ? VMA_SHMEM : VMA_FILE; + if (finfo.type == VMA_SHMEM) + return; /* Find owning device's queue/read_ahead_kb control */ if (snprintf(path, sizeof(path), "/sys/dev/block/%d:%d/uevent",