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 X-Spam-Level: X-Spam-Status: No, score=-5.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 09A1FC433DB for ; Mon, 18 Jan 2021 19:40:20 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 872B122C9D for ; Mon, 18 Jan 2021 19:40:17 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 872B122C9D Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=ziepe.ca Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id C4A398D0025; Mon, 18 Jan 2021 14:40:16 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id BFD1B8D0024; Mon, 18 Jan 2021 14:40:16 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id B124D8D0025; Mon, 18 Jan 2021 14:40:16 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0158.hostedemail.com [216.40.44.158]) by kanga.kvack.org (Postfix) with ESMTP id 9D8108D0024 for ; Mon, 18 Jan 2021 14:40:16 -0500 (EST) Received: from smtpin05.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id 58B088249980 for ; Mon, 18 Jan 2021 19:40:16 +0000 (UTC) X-FDA: 77719912032.05.crowd06_1c0c7c72754b Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin05.hostedemail.com (Postfix) with ESMTP id 3D7141801E8FA for ; Mon, 18 Jan 2021 19:40:16 +0000 (UTC) X-HE-Tag: crowd06_1c0c7c72754b X-Filterd-Recvd-Size: 5273 Received: from mail-qk1-f180.google.com (mail-qk1-f180.google.com [209.85.222.180]) by imf03.hostedemail.com (Postfix) with ESMTP for ; Mon, 18 Jan 2021 19:40:15 +0000 (UTC) Received: by mail-qk1-f180.google.com with SMTP id d14so19702133qkc.13 for ; Mon, 18 Jan 2021 11:40:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ziepe.ca; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=m0HuzB+USgUnbgOX7HG0Sx20ihZJUFQB5a8QjnGYmeo=; b=A+hqRW9O5yvkiX1OyU7UPWhIpta3IllcQ2sXxl2fVCFmkMSizioqELhPp3e2QoM8f7 igMw3Y6He8BvwWUdsVy3CxQdQojMpuHcG4WfivJ4tSXJranc1V7oTQIrLYjDXgMRS9rZ eIvTPEUqyxUBEVfO59ojHS/5uCPArVxP/FQr7OUq/yC4yYtu1SDfRPsj5T6lofbCPCXq qduo+tHn38eMxkGjHzU5srg9cOC/U10mM3Fii/Taczf+JD9p/uUF2NaBKt/x3jce2WeS u0yHgBwQT0bMeiNBcdl3buKIjV760UbTRMqor3+98AT65Q7cxyepGuxL50LFar+zxYQc TTng== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=m0HuzB+USgUnbgOX7HG0Sx20ihZJUFQB5a8QjnGYmeo=; b=R6s9khESdO/hhWnSVMc66oANV6y3vQuNP365Rg7qUAdXTUTd6+swbXlTrBvT2X5KWv DLc36oPw8GFk0w6EI2PsEGD4suNwAEKHRhd8ayVKJvIvsJOtyn06un+/v/6H0tQAod43 xgrYHlteU4S621AuuAWAgIK+TASWfsXe5wEVBhUuZpabiWhEMT2BKtzHYZeEm679CGrs MfPBl5AYm15u1nj5HFnf4aohBp7DAcb7kTh2a2G3iFEPJkNgtRJOH42GkvVra1X1jjh0 1AiynZIyFBvNfyBgKprguv7kPwMlA1uZxXoV5GILr0Huw+jwmcXjribLGItuhlBNzoBL J1oA== X-Gm-Message-State: AOAM533bhxvru26KnXl0N4oiA75Ytubf6peMtWM2H3w5YHOvCTjB5JeR /XGrkSrZLDKRv89KANicSh2cjg== X-Google-Smtp-Source: ABdhPJzBAWArmZw0A7cIsAoeqD8Frz7SjorZ9wI33QSkMgZ7Y0Jmmhu+pSwL5XOpa+cqadMWu5cNrg== X-Received: by 2002:a05:620a:12e5:: with SMTP id f5mr1087103qkl.331.1610998815056; Mon, 18 Jan 2021 11:40:15 -0800 (PST) Received: from ziepe.ca (hlfxns017vw-142-162-115-133.dhcp-dynamic.fibreop.ns.bellaliant.net. [142.162.115.133]) by smtp.gmail.com with ESMTPSA id e38sm10788881qtb.30.2021.01.18.11.40.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 Jan 2021 11:40:14 -0800 (PST) Received: from jgg by mlx with local (Exim 4.94) (envelope-from ) id 1l1aNp-00335L-Os; Mon, 18 Jan 2021 15:40:13 -0400 Date: Mon, 18 Jan 2021 15:40:13 -0400 From: Jason Gunthorpe To: Peter Xu Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org, Mike Rapoport , Mike Kravetz , Jerome Glisse , "Kirill A . Shutemov" , Hugh Dickins , Axel Rasmussen , Matthew Wilcox , Andrew Morton , Andrea Arcangeli , Nadav Amit Subject: Re: [PATCH RFC 07/30] mm/swap: Introduce the idea of special swap ptes Message-ID: <20210118194013.GM4605@ziepe.ca> References: <20210115170907.24498-1-peterx@redhat.com> <20210115170907.24498-8-peterx@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210115170907.24498-8-peterx@redhat.com> 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 Fri, Jan 15, 2021 at 12:08:44PM -0500, Peter Xu wrote: > We used to have special swap entries, like migration entries, hw-poison > entries, device private entries, etc. > > Those "special swap entries" reside in the range that they need to be at least > swap entries first, and their types are decided by swp_type(entry). > > This patch introduces another idea called "special swap ptes". > > It's very easy to get confused against "special swap entries", but a speical > swap pte should never contain a swap entry at all. It means, it's illegal to > call pte_to_swp_entry() upon a special swap pte. > > Make the uffd-wp special pte to be the first special swap pte. > > Before this patch, is_swap_pte()==true means one of the below: > > (a.1) The pte has a normal swap entry (non_swap_entry()==false). For > example, when an anonymous page got swapped out. > > (a.2) The pte has a special swap entry (non_swap_entry()==true). For > example, a migration entry, a hw-poison entry, etc. > > After this patch, is_swap_pte()==true means one of the below, where case (b) is > added: > > (a) The pte contains a swap entry. > > (a.1) The pte has a normal swap entry (non_swap_entry()==false). For > example, when an anonymous page got swapped out. > > (a.2) The pte has a special swap entry (non_swap_entry()==true). For > example, a migration entry, a hw-poison entry, etc. > > (b) The pte does not contain a swap entry at all (so it cannot be passed > into pte_to_swp_entry()). For example, uffd-wp special swap pte. Does the stuff in hmm.c need updating too? if (!pte_present(pte)) { swp_entry_t entry = pte_to_swp_entry(pte); Jason