From patchwork Wed Apr 13 19:11:47 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Xu X-Patchwork-Id: 12812463 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 12547C433EF for ; Wed, 13 Apr 2022 19:11:53 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 8B6336B0073; Wed, 13 Apr 2022 15:11:53 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 83F956B0074; Wed, 13 Apr 2022 15:11:53 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 68FF46B0075; Wed, 13 Apr 2022 15:11:53 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (relay.hostedemail.com [64.99.140.26]) by kanga.kvack.org (Postfix) with ESMTP id 572416B0073 for ; Wed, 13 Apr 2022 15:11:53 -0400 (EDT) Received: from smtpin20.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id 23E3A2282B for ; Wed, 13 Apr 2022 19:11:53 +0000 (UTC) X-FDA: 79352800506.20.402AE2A Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by imf29.hostedemail.com (Postfix) with ESMTP id 84163120008 for ; Wed, 13 Apr 2022 19:11:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1649877112; 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; bh=+QSw/ufRyN6/+ezAwZBDPPhNm6Hg19SNJxAw6AI4ros=; b=VnzG48EVHXb50ENdmevVWMLrKXeDl3/a3EPTQULkTQ6h0Dlup12FOF0oZDDlIhhE7VAjq3 5Z0Ue5zBr1aYgRqFyWXnF5+jYwus7iBPM85rYx2Rf3uAdACFLpsZmA2DvpSBmUREX8WLwl Lzah1swsItq5iTFapk7DRr+I3wzFCRc= Received: from mail-il1-f197.google.com (mail-il1-f197.google.com [209.85.166.197]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-604-3sfJEpHUPJqKaZLhRJk6sg-1; Wed, 13 Apr 2022 15:11:51 -0400 X-MC-Unique: 3sfJEpHUPJqKaZLhRJk6sg-1 Received: by mail-il1-f197.google.com with SMTP id v14-20020a056e020f8e00b002caa6a5d918so1721211ilo.15 for ; Wed, 13 Apr 2022 12:11:51 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=+QSw/ufRyN6/+ezAwZBDPPhNm6Hg19SNJxAw6AI4ros=; b=rNcUDwhR5myJAVcevN4jAK7iYmSEgbK3ARBEaWtjHadANmbhWUri3mo6NjidZZU/wW t0b5p6LJUmBHFVJ8f1UP+0OQq6QRfZ38EP+Rb+PsSjMkVkhW7zN99lmBAMl1ZMZe+TCJ arGBJOLhqUJrGipr4smhuu7Enavlk9cUAYWMWmYyXGpXSjtMZAdpsk47Lj+UW+ybsUsz htI00rJwZhseg78Iea5UFSwjTiKgMshzx/Pk76k3J4fHNUtQ9+cLPWCwhYHCytegjGQT I/NXk/AgajXleFiEyksGfDuOCkVq0RHDKd6Q00Xn/hlltyu+FuOC47O+VQ7fIUVhwS9P qrFQ== X-Gm-Message-State: AOAM53299HO7d3q0xunBjDxwmM8WV+NZQ8x9jBWohQ+xweGt9sqWmLI1 9QUx2cFke1AGBVb1b7ONN47uBv/TZiHOOqB7PQUR5cShpgt2Wg0+nPF3psSi/NA7XCSNaC20oqL EQyui7QKCg2c= X-Received: by 2002:a05:6638:481a:b0:326:6a2c:2396 with SMTP id cp26-20020a056638481a00b003266a2c2396mr1912001jab.122.1649877110382; Wed, 13 Apr 2022 12:11:50 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwihmTKTsBKEM8uRlTQTE9G8Q2zcvgmyT1yNLtqG/qXCjQd4VTDWCSV13OhoOS2+SRctMU8/Q== X-Received: by 2002:a05:6638:481a:b0:326:6a2c:2396 with SMTP id cp26-20020a056638481a00b003266a2c2396mr1911987jab.122.1649877109997; Wed, 13 Apr 2022 12:11:49 -0700 (PDT) Received: from localhost.localdomain (cpec09435e3e0ee-cmc09435e3e0ec.cpe.net.cable.rogers.com. [99.241.198.116]) by smtp.gmail.com with ESMTPSA id z72-20020a6bc94b000000b006463c801381sm439896iof.48.2022.04.13.12.11.49 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Wed, 13 Apr 2022 12:11:49 -0700 (PDT) From: Peter Xu To: akpm@linux-foundation.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org Cc: Peter Xu , Alistair Popple Subject: [PATCH] mm: Remove stub for non_swap_entry() Date: Wed, 13 Apr 2022 15:11:47 -0400 Message-Id: <20220413191147.66645-1-peterx@redhat.com> X-Mailer: git-send-email 2.32.0 MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-Rspamd-Server: rspam06 X-Rspamd-Queue-Id: 84163120008 X-Rspam-User: Authentication-Results: imf29.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=VnzG48EV; dmarc=pass (policy=none) header.from=redhat.com; spf=none (imf29.hostedemail.com: domain of peterx@redhat.com has no SPF policy when checking 170.10.133.124) smtp.mailfrom=peterx@redhat.com X-Stat-Signature: 11k1rgxf9bg61srj8fu9dcyh8yztawqt X-HE-Tag: 1649877112-606125 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: The stub for non_swap_entry() may not help much, because MAX_SWAPFILES has already contained all the information to decide whether a swap entry is real swap entry of pesudo ones (migrations, ...). There can be some performance influences on non_swap_entry() with below conditions all met: !CONFIG_MIGRATION && !CONFIG_MEMORY_FAILURE && !CONFIG_DEVICE_PRIVATE But that's definitely not the major config most machines will use, at the meantime it's already in a slow path of swap entry (being parsed from a swap pte), so IMHO it shouldn't be a major issue. Also according to the analysis from Alistair, somehow the stub didn't do the job right [1]. To make the code cleaner, let's drop the stub. [1] https://lore.kernel.org/lkml/8735ihbw6g.fsf@nvdebian.thelocal/ Cc: Alistair Popple Signed-off-by: Peter Xu Reviewed-by: Alistair Popple --- Note: the uffd-wp shmem & hugetlbfs series will need this patch to make sure swap entries work as expected with below config as spotted by Alistair: !CONFIG_MIGRATION && !CONFIG_MEMORY_FAILURE && !CONFIG_DEVICE_PRIVATE && CONFIG_PTE_MARKER (PS: this config should mostly never gonna happen, though, afaict..) Quoting the same thread [1] as above. Please review, thanks. --- include/linux/swapops.h | 8 -------- 1 file changed, 8 deletions(-) diff --git a/include/linux/swapops.h b/include/linux/swapops.h index fffbba0036f6..a291f210e7f8 100644 --- a/include/linux/swapops.h +++ b/include/linux/swapops.h @@ -493,18 +493,10 @@ static inline void num_poisoned_pages_inc(void) } #endif -#if defined(CONFIG_MEMORY_FAILURE) || defined(CONFIG_MIGRATION) || \ - defined(CONFIG_DEVICE_PRIVATE) static inline int non_swap_entry(swp_entry_t entry) { return swp_type(entry) >= MAX_SWAPFILES; } -#else -static inline int non_swap_entry(swp_entry_t entry) -{ - return 0; -} -#endif #endif /* CONFIG_MMU */ #endif /* _LINUX_SWAPOPS_H */