Message ID | 20220927033854.477018-1-zokeefe@google.com (mailing list archive) |
---|---|
State | New |
Headers | show
Return-Path: <owner-linux-mm@kvack.org> 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 41F72C07E9D for <linux-mm@archiver.kernel.org>; Tue, 27 Sep 2022 03:38:58 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id A28708E00A9; Mon, 26 Sep 2022 23:38:57 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 9D6EA8E0090; Mon, 26 Sep 2022 23:38:57 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 89EB58E00A9; Mon, 26 Sep 2022 23:38:57 -0400 (EDT) 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 780D18E0090 for <linux-mm@kvack.org>; Mon, 26 Sep 2022 23:38:57 -0400 (EDT) Received: from smtpin14.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id 4FCCC80688 for <linux-mm@kvack.org>; Tue, 27 Sep 2022 03:38:57 +0000 (UTC) X-FDA: 79956459114.14.FEAC8FC Received: from mail-pj1-f74.google.com (mail-pj1-f74.google.com [209.85.216.74]) by imf10.hostedemail.com (Postfix) with ESMTP id 0A9C4C0006 for <linux-mm@kvack.org>; Tue, 27 Sep 2022 03:38:56 +0000 (UTC) Received: by mail-pj1-f74.google.com with SMTP id pc10-20020a17090b3b8a00b00202be8d81d2so8786402pjb.1 for <linux-mm@kvack.org>; Mon, 26 Sep 2022 20:38:56 -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=yU6Z6HFwvuAoW5fIplV+P+fDUDSdmYKrLwOn1hU/Qgs=; b=qHmU32QsBfN38w9NOBnEd3Ukw3AhYciEU4N8/H+KHFey5BEIjdcdgdCJKeHIQ7cpRK QExbZSza3JQQfWp0nqIa7y9UzE5EIAfd/ahNMmMZWrdjZzRu9Ptrq8gWGDbTEBEvqkkO jy+8z8F9Ni/a4ZBJBTPAOnNnfNqJoh3+dNaSIfb0XghtN9z5W87qdDIe+fQDi5CcSkq2 5qhQeeuFw4Ty4/SA6Fu0uTzyJp13qMWDTTtOHuVVIxOoYCQMfEY759lWL/wMVYHnQc0s kiddbgE1fmGWUJKXtYMBrKXbhXmknW001blF+7E5edK4G5kcJSd2EDvvBef6jznbbsnc XiuQ== 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=yU6Z6HFwvuAoW5fIplV+P+fDUDSdmYKrLwOn1hU/Qgs=; b=ecl7Yocqov4uUdVEh+KNAQtrJuq31ouKvEyM8zwfL3xJSlotwfUzJHpXp3j8562FBx LVYoZLavFmhhDnAd9tTmuGqEu0MqndOqJFjBhygxrt7TBG0EFmlukaHChhbK8QYry/aS U52Vs5em3fj5sQvOdsVtu29ovAquFFeqQGYYQmZENXOnOdqnboJbnreQMU1Uj0nvEp9N ZUwdz/v/C/MmljJMt54ESmc1rqdM44DQ4x5l+mCM/PFTHdDj3SAY6OYc5jCbdnRr13io rz9jg0alNMqdSFNDq50P3ovkLlP8OY99B5RsNDi6Q21wfVbCm9orCccwiBa9eJW/LrI1 j6fQ== X-Gm-Message-State: ACrzQf3rcuNZOA5bCsVVpzvxqE4ppQUXzN4zZIYwGmHdFBiVfFFcZcb+ bk3wBd0jEuV7//aILgaCDwGNGbArO68H X-Google-Smtp-Source: AMsMyM61LXf7rD3iWnstApkEaa25hBo73MpYBtYiW8OoxhMIiQC4i1qsoCoDHExwr5pkNFx8D3gyo5EofioX X-Received: from zokeefe3.c.googlers.com ([fda3:e722:ac3:cc00:7f:e700:c0a8:1b6]) (user=zokeefe job=sendgmr) by 2002:a17:90a:ba8f:b0:202:f6b1:eebc with SMTP id t15-20020a17090aba8f00b00202f6b1eebcmr2205337pjr.241.1664249936016; Mon, 26 Sep 2022 20:38:56 -0700 (PDT) Date: Mon, 26 Sep 2022 20:38:54 -0700 Mime-Version: 1.0 X-Mailer: git-send-email 2.37.3.998.g577e59143f-goog Message-ID: <20220927033854.477018-1-zokeefe@google.com> Subject: [PATCH mm-unstable] mm/khugepaged: don't check pmd value twice in collapse_pte_mapped_thp() From: "Zach O'Keefe" <zokeefe@google.com> To: Andrew Morton <akpm@linux-foundation.org> Cc: linux-mm@kvack.org, Yang Shi <shy828301@gmail.com> Content-Type: text/plain; charset="UTF-8" ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1664249937; 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=yU6Z6HFwvuAoW5fIplV+P+fDUDSdmYKrLwOn1hU/Qgs=; b=1gxY60anDF4NXZ/RAN3sjSoEkTagW3BWDQTZnSNWTX8svUOaPapTU5a9kqmHXe8Q0KcHuA MrBo7XoRgHw1f2GsBfhzD3xX18B1aBG32fUzOqf09+o+K0rGTVgvkfQwcSQbCv7WADIw0H WdErDggTQdWuGAXj+FAHrA+KW9gaH7Y= ARC-Authentication-Results: i=1; imf10.hostedemail.com; dkim=pass header.d=google.com header.s=20210112 header.b=qHmU32Qs; dmarc=pass (policy=reject) header.from=google.com; spf=pass (imf10.hostedemail.com: domain of 3UHAyYwcKCBsQFB55657FF7C5.3FDC9ELO-DDBM13B.FI7@flex--zokeefe.bounces.google.com designates 209.85.216.74 as permitted sender) smtp.mailfrom=3UHAyYwcKCBsQFB55657FF7C5.3FDC9ELO-DDBM13B.FI7@flex--zokeefe.bounces.google.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1664249937; a=rsa-sha256; cv=none; b=IWoge4rDjzm4V94eZKyV9dAMA7wWGILmD5YBW+oLJUdVxenVZjODqHC+kpWAPwZKaOzSms dJAVHsAb6iHM7cQmfiGq+ayJiIjfkdACErRHrnaSGulupJh4q7DYqSJ7sbWQbNS4nak4Pn qNxbkpJoHYan6B5RQqFGbbnoeuJd+cQ= X-Rspam-User: Authentication-Results: imf10.hostedemail.com; dkim=pass header.d=google.com header.s=20210112 header.b=qHmU32Qs; dmarc=pass (policy=reject) header.from=google.com; spf=pass (imf10.hostedemail.com: domain of 3UHAyYwcKCBsQFB55657FF7C5.3FDC9ELO-DDBM13B.FI7@flex--zokeefe.bounces.google.com designates 209.85.216.74 as permitted sender) smtp.mailfrom=3UHAyYwcKCBsQFB55657FF7C5.3FDC9ELO-DDBM13B.FI7@flex--zokeefe.bounces.google.com X-Rspamd-Server: rspam10 X-Rspamd-Queue-Id: 0A9C4C0006 X-Stat-Signature: ujmnot9r883wzetaaqxy74k7kisii43b X-HE-Tag: 1664249936-903592 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: <linux-mm.kvack.org> |
Series |
[mm-unstable] mm/khugepaged: don't check pmd value twice in collapse_pte_mapped_thp()
|
expand
|
diff --git a/mm/khugepaged.c b/mm/khugepaged.c index 6d2dfd96608a..c7699fabf302 100644 --- a/mm/khugepaged.c +++ b/mm/khugepaged.c @@ -1463,8 +1463,6 @@ int collapse_pte_mapped_thp(struct mm_struct *mm, unsigned long addr, goto drop_hpage; } - if (find_pmd_or_thp_or_none(mm, haddr, &pmd) != SCAN_SUCCEED) - result = find_pmd_or_thp_or_none(mm, haddr, &pmd); switch (result) { case SCAN_SUCCEED: break;
During the v3 -> v4 merge of series "mm: add file/shmem support to MADV_COLLAPSE", a line deletion was accidentally dropped, which left collapse_pte_mapped_thp() in state: ---8<--- <mmap_lock held exclusively> result = find_pmd_or_thp_or_none(mm, haddr, &pmd); <other checks that don't change "result" unless fail> (*) if (find_pmd_or_thp_or_none(mm, haddr, &pmd) != SCAN_SUCCEED) result = find_pmd_or_thp_or_none(mm, haddr, &pmd); switch (result) { case SCAN_SUCCEED: ---8<--- Where (*) is the line that should have been deleted (note that this is still legal C). Since the selftests are still passing, this mistake highlights the fact that the second (intended) find_pmd_or_thp_or_none() isn't necessary: the first one is called with mmap_lock held exclusively, we don't drop the lock in this function, and "result" isn't changed between assignment and use in the switch-statement (except for failure paths which either return early or skip to "drop_hpage" label). Remove the second (intended) find_pmd_or_thp_or_none() check, and the misplaced find_pmd_or_thp_or_none() if-statement line. Fixes: c27451af51cc ("mm/madvise: add file and shmem support to MADV_COLLAPSE") Signed-off-by: Zach O'Keefe <zokeefe@google.com> --- Andrew, apologies about letting this sneak through (both the needless check, and the trivial merge error). Please consider taking into mm-unstable to clean things up there. Will try to catch these better in the future. Thank you. mm/khugepaged.c | 2 -- 1 file changed, 2 deletions(-)