From mboxrd@z Thu Jan 1 00:00:00 1970 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 D4408C433F5 for ; Tue, 12 Apr 2022 19:45:23 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 1A1E56B0072; Tue, 12 Apr 2022 15:45:23 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 14F906B0073; Tue, 12 Apr 2022 15:45:23 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id F0B6F6B0074; Tue, 12 Apr 2022 15:45:22 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (relay.hostedemail.com [64.99.140.28]) by kanga.kvack.org (Postfix) with ESMTP id DDDE46B0072 for ; Tue, 12 Apr 2022 15:45:22 -0400 (EDT) Received: from smtpin09.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay11.hostedemail.com (Postfix) with ESMTP id AAB2D80409 for ; Tue, 12 Apr 2022 19:45:22 +0000 (UTC) X-FDA: 79349256084.09.54048DE Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by imf05.hostedemail.com (Postfix) with ESMTP id 0632410000A for ; Tue, 12 Apr 2022 19:45:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1649792721; 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: in-reply-to:in-reply-to:references:references; bh=WpG5ULDIWtR6MAD2NZ7Y0GsTIabSBZ3X6PEQkqyZxBI=; b=D8c08brRT73HVKkzCUdNgqwgxTFbPbt76GBalgmj0MgjdT5ViKqzEAEPoASxSCu89qfm2k j5wh65KDz72WoUDIqPGYUu8ocXP5ftTKVVJwz7JUVVrGS15fllbVna11xuVU5D2u7kpENJ RPkW7tryhAS6EkKPE/9kQzx69Oh57p0= Received: from mail-il1-f199.google.com (mail-il1-f199.google.com [209.85.166.199]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-522-Xfrbd5X-O5CJhCEysxisoQ-1; Tue, 12 Apr 2022 15:45:20 -0400 X-MC-Unique: Xfrbd5X-O5CJhCEysxisoQ-1 Received: by mail-il1-f199.google.com with SMTP id j4-20020a92c204000000b002caad37af3fso5161946ilo.22 for ; Tue, 12 Apr 2022 12:45:19 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=WpG5ULDIWtR6MAD2NZ7Y0GsTIabSBZ3X6PEQkqyZxBI=; b=YhJrtdT051ZZCLlV2AFrkM4944eH3ANbMc8Jj5zwZ2B0go7IHWKR7ErPXm5/ugZ2uV 4MwwAvrMxRp7n9xsalbYa2lXisKmYp8Q/+O5cqPAxLpqWYtfLdh7rGN6Ex1UCV6BEMr5 FJCj4I4H4ZknK1zB5KVewxgfvMtHXmKjFt0ViwRVvGTyAZtR1xAet0He8MARlPrR/Qpr +huSkmnMR2Z03bXLAAWljtUo082cj5Fx8fFq6beabgn713FokPH4Wn1nVgO/YjvlH/cC oQnMwvPIOReJ7sNtPWqWGKGQjo7YBr0Iwotdo2H0O2h0jf/W4v8GnLGynGW33g7h6Peq UruQ== X-Gm-Message-State: AOAM530A4rGHGEPqbSgQJeJPN1oEkmgI6tES9DD6oIv1dqpnL8S5ckZZ lST+kTl1wxuIrqYKSfKXoHQU5Ff0uJNTSJn6svq6BwNd/3sLN8ttKuyZJTxk03ADhUcXLKLl2Sc e7qwRmqiWuDE= X-Received: by 2002:a05:6638:2041:b0:323:b749:f52d with SMTP id t1-20020a056638204100b00323b749f52dmr17008222jaj.306.1649792719343; Tue, 12 Apr 2022 12:45:19 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwcjlWXnaygTtgjP1hPyx4RLhLUfitY3W7bEerI41T+XUGE4bcRNUUxW1dD8cXewiOn0M3SEA== X-Received: by 2002:a05:6638:2041:b0:323:b749:f52d with SMTP id t1-20020a056638204100b00323b749f52dmr17008209jaj.306.1649792719089; Tue, 12 Apr 2022 12:45:19 -0700 (PDT) Received: from xz-m1.local (cpec09435e3e0ee-cmc09435e3e0ec.cpe.net.cable.rogers.com. [99.241.198.116]) by smtp.gmail.com with ESMTPSA id w1-20020a056e021a6100b002caa71d8d98sm5359586ilv.49.2022.04.12.12.45.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Apr 2022 12:45:18 -0700 (PDT) Date: Tue, 12 Apr 2022 15:45:17 -0400 From: Peter Xu To: Alistair Popple Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org, Mike Kravetz , Andrew Morton , David Hildenbrand , Matthew Wilcox , Nadav Amit , Axel Rasmussen , Andrea Arcangeli , "Kirill A . Shutemov" , Hugh Dickins , Jerome Glisse , Mike Rapoport Subject: Re: [PATCH v8 01/23] mm: Introduce PTE_MARKER swap entry Message-ID: References: <20220405014646.13522-1-peterx@redhat.com> <20220405014646.13522-2-peterx@redhat.com> <87bkx7ayfs.fsf@nvdebian.thelocal> MIME-Version: 1.0 In-Reply-To: <87bkx7ayfs.fsf@nvdebian.thelocal> X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=utf-8 Content-Disposition: inline X-Rspamd-Server: rspam09 X-Rspam-User: X-Stat-Signature: hjj6beb57ptf18fs1iiyqn3e79wuxk47 Authentication-Results: imf05.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=D8c08brR; dmarc=pass (policy=none) header.from=redhat.com; spf=none (imf05.hostedemail.com: domain of peterx@redhat.com has no SPF policy when checking 170.10.133.124) smtp.mailfrom=peterx@redhat.com X-Rspamd-Queue-Id: 0632410000A X-HE-Tag: 1649792721-543271 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: On Tue, Apr 12, 2022 at 11:07:56AM +1000, Alistair Popple wrote: > Hi Peter, Hi, Alistair, > > I noticed this while reviewing the next patch in the series. I think you need to > add CONFIG_PTE_MARKER to the below as well: > > #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 > > Otherwise marker entries will be treated as swap entries, which is wrong for > example in swapin_walk_pmd_entry() as marker entries are no longer considered > pte_none(). Thanks for the comment, that makes sense. Instead of adding PTE_MARKER into this equation, I'm going backward and wondering purely on why we need to bother with non_swap_entry() at all if MAX_SWAPFILES is already defined with proper knowledges of all these bits. #define MAX_SWAPFILES \ ((1 << MAX_SWAPFILES_SHIFT) - SWP_DEVICE_NUM - \ SWP_MIGRATION_NUM - SWP_HWPOISON_NUM) So, I agree with your analysis, but instead of adding PTE_MARKER, what do you think about we dropping that complexity as a whole (possibly with a standalone patch)? ---8<--- diff --git a/include/linux/swapops.h b/include/linux/swapops.h index d356ab4047f7..5af852b68805 100644 --- a/include/linux/swapops.h +++ b/include/linux/swapops.h @@ -387,18 +387,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 */ ---8<--- Thanks, -- Peter Xu