Received: by 2002:a05:6a10:6d10:0:0:0:0 with SMTP id gq16csp43729pxb; Tue, 12 Apr 2022 16:17:18 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwxYXe1VP1qs8c7wba+ifkM/XuagPLWpYfOaadT8683Vdaysa/CDgnDJxmiWBSwIj65dz8x X-Received: by 2002:a17:90a:c792:b0:1ca:4d2f:3f1b with SMTP id gn18-20020a17090ac79200b001ca4d2f3f1bmr7458092pjb.86.1649805438285; Tue, 12 Apr 2022 16:17:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649805438; cv=none; d=google.com; s=arc-20160816; b=NcNpcXjnuL+sTFFgQJwjvB9xXxgvoNMGNbAtJYsc3/ex90GHydxGWf4GvKtRxmPMES IWWk1ZMtmjTJC0uhFrKlrh9Z/lxMBghB3+QigwEWRQrsD1xi4L5EEtIvYbqPPDlh71tJ Fb30cloabixDgSjX07c0lQn42t6w+KRIAlc4CnLYv1V97ECAEF7TDA4WV3WSJG3B4KRR FYZ2KAEc8KgKXtn4i9BPTkc7hC4KPdqRFPnTfp76dYJt5uBMXDzmLyv76LnRE5qT71n1 By4FcNgUaTFCkPrl7zgiJlMgsB7BDD6DF6gC6nr8n7KQhYETY+IR7XjpW+CaexbO+ci3 FpYA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=WpG5ULDIWtR6MAD2NZ7Y0GsTIabSBZ3X6PEQkqyZxBI=; b=vARXwiapWFlN13ulVdSDaaultCZKv4B+5QhOlnPF0NlVYLvbZjrmWHtbeqrAYuX+Vn uOguUNmNxlhd+hp6JLzpYHgfV6n22xKKC0PUB5Y282RBR+04KpgAElxDud5Wdta8qDZD MHC2D9A7T/Y3gYitEes+nP2O8wx4qA8YKvflsNl3d8sS86q0URHR7FCQbhzWIIRQ1SH0 VyliOFXWNPWEAfoz0NMkTUxlC2OJctTLCA7rs3wUSOvoSGGblSJli5n4ZQUqq1YDUdau NBvgy058rD/AJIs1vD1rqvuybNwFVnwsFwBazHYPH2Hc3FGpCuUGVzyA6j+ITrNeE2Qp 9o3Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=D8c08brR; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id y37-20020a056a00182500b00505c8d2d5f3si7139632pfa.143.2022.04.12.16.17.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Apr 2022 16:17:18 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=D8c08brR; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id E763321C703; Tue, 12 Apr 2022 15:01:54 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232866AbiDLTuU (ORCPT + 99 others); Tue, 12 Apr 2022 15:50:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49324 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231718AbiDLTti (ORCPT ); Tue, 12 Apr 2022 15:49:38 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 8D19366C8E for ; Tue, 12 Apr 2022 12:45:22 -0700 (PDT) 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-619-Huai4W5bNAeQv8Y0AnYZTQ-1; Tue, 12 Apr 2022 15:45:20 -0400 X-MC-Unique: Huai4W5bNAeQv8Y0AnYZTQ-1 Received: by mail-il1-f199.google.com with SMTP id q6-20020a056e0215c600b002c2c4091914so13341324ilu.14 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=6DDGFTUWKKtvyxBaYCUDlWRtji6Tn6ujXPvHK7Gglyl5Crw5k3uL13o7L7T0hvcugG vJPb6JVNb4n/5eOZWApCLAnSjqLRTV19ZrxkEI01LMqNYEolb69Z2WqQy2GDzrAZ2ZZV Kb3pMQWJBsm+H4HUyrF2XrqBS097jCjpsEqTVbbdi5z8MFIPMOLDIwPJfD36qrlMlM1L 8CiKePM304+Qpc/e/To87x9R/XsSnk99o5yG20l8+2GO/YgZbhHUdXqCcf0wseERfKA1 3l9GbdQHY8xmrTF0IJqWgLNmiYS6dcCQPhw9L8nCqGnVRNtxsz6b1c2y0ctnZd95yko+ 2JDw== X-Gm-Message-State: AOAM531wHHlX321LWis2mZBkIJqAp6IZOGk/nAVcOYSCbhSnQHfRwRbn tRBGGC8fjy8dSjfksaipw3qwO7nW0DdLK1d/JOh3/GiXII4auisMl7mI1fvslyOXB0KXdfLC8En 67fz4+lqewys9mJmbu5uMRIVz X-Received: by 2002:a05:6638:2041:b0:323:b749:f52d with SMTP id t1-20020a056638204100b00323b749f52dmr17008227jaj.306.1649792719346; Tue, 12 Apr 2022 12:45:19 -0700 (PDT) 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 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <87bkx7ayfs.fsf@nvdebian.thelocal> X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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