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 3ADC9C433FE for ; Thu, 20 Jan 2022 18:19:57 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id B45146B009C; Thu, 20 Jan 2022 13:19:56 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id AF3D96B009E; Thu, 20 Jan 2022 13:19:56 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 96CD96B00A0; Thu, 20 Jan 2022 13:19:56 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0031.hostedemail.com [216.40.44.31]) by kanga.kvack.org (Postfix) with ESMTP id 834B56B009C for ; Thu, 20 Jan 2022 13:19:56 -0500 (EST) Received: from smtpin12.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id 3E6CE8DA47 for ; Thu, 20 Jan 2022 18:19:56 +0000 (UTC) X-FDA: 79051479192.12.C7A2C2C 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 BE99210000A for ; Thu, 20 Jan 2022 18:19:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1642702795; 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: in-reply-to:in-reply-to:references:references; bh=rKxyIeZW7RYW3u4+X955jRymBZg+th+EIWA7v064V2E=; b=cAUtShJbQ+jTNurs/x79rMhXzP44gJ15ynQgkbwKWZyrYtfEIn8O9h/c1Gk7/zZCbWge0p MTkvegqKUPPKlSB1Fo1BmDs3tWiXz5Z0O+tTTAUCnr3ye4Tb3Q2kvrz3++i4h3So2jABdi RFiM00h8+sYRauNfpCX7fSR2oChB9UU= Received: from mail-ed1-f69.google.com (mail-ed1-f69.google.com [209.85.208.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-616-uXTXA1Z5NUuguUSI1vehtQ-1; Thu, 20 Jan 2022 13:19:54 -0500 X-MC-Unique: uXTXA1Z5NUuguUSI1vehtQ-1 Received: by mail-ed1-f69.google.com with SMTP id bm21-20020a0564020b1500b00402c34373f9so6702894edb.2 for ; Thu, 20 Jan 2022 10:19:53 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:date:mime-version:user-agent:subject :content-language:to:cc:references:from:organization:in-reply-to :content-transfer-encoding; bh=rKxyIeZW7RYW3u4+X955jRymBZg+th+EIWA7v064V2E=; b=sL8UqlHcLKNsp5oAYDnFwWoHe+NmhDKzb3IB5TODdMQrQVaEFkCyzvPsujlVe9VZjj 6rbXQF8L8Xz+LHkVMJiMh9yfEYHRwA6f7x6jpD6TUnOKTh/0tqFx6+XAVmlDZXRZcK4N keimI20HZq+Q/YppC4A6CDL4dIYBdounqjsuO5jlVmU/J5JnOgKnHzbfMpkFXrZrwjHz s1Kz1og34B+tPmVXQ0f5nCFHTr8W3sZkRUpgUiee6NNcC9kg0I1uCFGFMwKt40gne1GQ 78tNCQKjHTzd02n8GvxjwJy86QcrNvjUUEae0hY4eqdTxPWCaxPfjs0c/9yochIBMIig aZmw== X-Gm-Message-State: AOAM532OHCA+F0R0eYbqSULyGyNvMPpfJplfP0yjkTEOhNloc2oICVd4 oSnIwk/pOtX4vr6ENHl8ppfcmdCBWYiJfm5ID/PwGFhLAA85lr51PdRBYV05KKAO6oB4vNOs1x8 jwcrkk//c0T0= X-Received: by 2002:a17:907:7d8a:: with SMTP id oz10mr113650ejc.320.1642702792938; Thu, 20 Jan 2022 10:19:52 -0800 (PST) X-Google-Smtp-Source: ABdhPJwU9TWkRnVmK3HK4zfioqdII11rqxD40tMTTzfgBpEJQdwiaFvEt+7U82gMa0IM1APSiHIlfg== X-Received: by 2002:a17:907:7d8a:: with SMTP id oz10mr113628ejc.320.1642702792649; Thu, 20 Jan 2022 10:19:52 -0800 (PST) Received: from ?IPV6:2003:cb:c70e:5800:eeb:dae2:b1c0:f5d1? (p200300cbc70e58000eebdae2b1c0f5d1.dip0.t-ipconnect.de. [2003:cb:c70e:5800:eeb:dae2:b1c0:f5d1]) by smtp.gmail.com with ESMTPSA id g9sm1287766ejf.33.2022.01.20.10.19.51 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 20 Jan 2022 10:19:52 -0800 (PST) Message-ID: <0b734af9-d2c3-acef-3804-3a87e1e61a59@redhat.com> Date: Thu, 20 Jan 2022 19:19:51 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.4.0 Subject: Re: [PATCH] mm: reuse the unshared swapcache page in do_wp_page To: Nadav Amit Cc: "zhangliang (AG)" , Andrew Morton , Linux-MM , Linux Kernel Mailing List , wangzhigang17@huawei.com, Matthew Wilcox , Linus Torvalds References: <20220113140318.11117-1-zhangliang5@huawei.com> <172ccfbb-7e24-db21-7d84-8c8d8c3805fd@redhat.com> <9cd7eee2-91fd-ddb8-e47d-e8585e5baa05@redhat.com> <747ff31c-6c9e-df6c-f14d-c43aa1c77b4a@redhat.com> <8931808d-db61-0f06-ceb3-f48a83b1f74c@redhat.com> <6225EAFF-B323-4DC5-AC4C-885B29ED7261@gmail.com> From: David Hildenbrand Organization: Red Hat In-Reply-To: <6225EAFF-B323-4DC5-AC4C-885B29ED7261@gmail.com> X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Language: en-US Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Rspamd-Server: rspam11 X-Rspamd-Queue-Id: BE99210000A X-Stat-Signature: ajpcgrs4rixad1z3jn85i57m3mzejc3m Authentication-Results: imf05.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=cAUtShJb; dmarc=pass (policy=none) header.from=redhat.com; spf=none (imf05.hostedemail.com: domain of david@redhat.com has no SPF policy when checking 170.10.133.124) smtp.mailfrom=david@redhat.com X-HE-Tag: 1642702795-292835 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: >> Sounds good? At least to me. If only swap/migration entries wouldn't be >> harder to handle than I'd wish, that's why it's taking a little and will >> take a little longer. > > Thanks for the quick response. I would have to see the logic to set/clear > PageAnonExclusive to fully understand how things are handled. > I'll let you know as soon as I have something. I'll most probably share a document explaining the design first. > BTW, I just saw this patch form PeterZ [1] that seems to be related, as > it deals with changing protection on pinned pages. Unfortunately the use of page_maybe_dma_pinned() is racy, as we can race with GUP fast. It's a problem for vmscan which currently relies on it for correctness. For migration, it might be good enough as we should fail later when trying to freeze the refcount. > > > [1] https://lore.kernel.org/linux-mm/20220120160822.666778608@infradead.org/ > -- Thanks, David / dhildenb