Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp581734pxk; Wed, 23 Sep 2020 10:27:18 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyZ642WoLeWbfywE6rlgmIxRz3kJ2kY8LXa6KcQnDGPNqj+cAbXicNPX9tSNyNQqRL3ZgA+ X-Received: by 2002:aa7:c61a:: with SMTP id h26mr414816edq.254.1600882038714; Wed, 23 Sep 2020 10:27:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1600882038; cv=none; d=google.com; s=arc-20160816; b=K7SDmB8dgRFlYpEVr7DtXsY7NAWqBqN5+Rarmvu+DlcxbI47/JQvH+hyv7R4WNPrP3 UkEmLc1uhBhDaUr69WJiHJJveR4nssu60kQu+5eNqXLPaG1xEh/Pc7el/hbL9MRMs6UA Xw5OFyVKD3tg+TROZ5ND0TZTyCDvrVsY5s42iIn0edUVE3QC6JrR7qwUEpGmyi6Q9cFp Co8y12WMJqp5/KGw5Ky2+P8l7ZyXccj8wxe5/PWkf9NWjymVqngxNaRRVkt34Pj442BU WuIkj4ok7nieJDzTbpoD0YxJNKG/bIltCHuxYOL0Xgs/lr5zdr0TA/xT446Ic+knWFRJ PHRg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=Lk74hRwBOjXHi2fDp7TcFPuA3uKeiSvp+FT3AfpwVzQ=; b=uBPCIyeU15lTXUe2PnjLA9FqfTwQoFxYIk9KWeh4tjlvb5neRYUsv3+L1fRpLXy/1S zF7JcAaaTzKD8OmWf8x4tRNZNeOddcTfmQTSCZxqx0UyYGBHaEUOnM1lhd1kiHRiji5l BQAWKuA6+0Tr2qerS7RP/FnQ2ib5ggQqaHWM0WNCWxkhdg6wvpDvkSkczf4ak7yO9csb W+z4Lir+At9GNnZXIJSmQvHWat/wvqtmCuvMI6qL0Z/D/u2McAOX26Nlm8sK7WiRJemG hVz/JOaqkmYDuEptMKnw8WY26qifen0TBPSM8qhVMJH80k+CtRD+JmIzpNAmOMIZAxbU au6A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=google header.b=bvyqVhNU; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id y39si364979ede.275.2020.09.23.10.26.54; Wed, 23 Sep 2020 10:27:18 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=google header.b=bvyqVhNU; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726731AbgIWRWs (ORCPT + 99 others); Wed, 23 Sep 2020 13:22:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60166 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726670AbgIWRWs (ORCPT ); Wed, 23 Sep 2020 13:22:48 -0400 Received: from mail-ej1-x641.google.com (mail-ej1-x641.google.com [IPv6:2a00:1450:4864:20::641]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 05585C0613D1 for ; Wed, 23 Sep 2020 10:22:48 -0700 (PDT) Received: by mail-ej1-x641.google.com with SMTP id p9so716148ejf.6 for ; Wed, 23 Sep 2020 10:22:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux-foundation.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=Lk74hRwBOjXHi2fDp7TcFPuA3uKeiSvp+FT3AfpwVzQ=; b=bvyqVhNUE2X8gzUG+6FM/3oxDUOxRrzvU8MuQ6kjYex/v1VvTGCzA8kYXcdpKiCRbo w8Cp+VjdMQ96dBtToeQdiBbFwgOVwFFn1suwEyWBk41Rpwo37BUD8hue0jP72VBGscC+ CXtiUAS0QDu23/lULwa5VxXDSIewalROgE3sw= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=Lk74hRwBOjXHi2fDp7TcFPuA3uKeiSvp+FT3AfpwVzQ=; b=eZDxsJlkhsfIjzVzOLDsetop5NYrxjqkInTcejuzBnFiENKPTMCRwIM+Ze3MNL648S SslWK5/V60jBFcBxeHFdAp3pQ0+lBFkrq4Rf5ye2KsNoLfWzB9lF5BkbY21i6oVbC5Wr FWMM0Div/rz6lvDLEhxX0qzddKFtQArZ6JYuPAcyvQu+30YbxQYUijTSDt1+aJ+/cnfZ FSJ2ifqhcB5j2lI+9lJdsySS9juCtrGmKB/dSxoEteQIBkvesCwQk+JVU+KqX8J3A46x c/19uVs+xCLCbiQ3jXrDFfl93TbiOHGImHlBpthYpPxzyKnPx4UeXvNbnPUHfAG4mara dKew== X-Gm-Message-State: AOAM530I4/H+te5Sa4ygBOPGa1OzBxzoI6lcHmRKqNUTnjqYeWNTvgiy RNlCTBzXlmfw90YrmrHJSkBkUDScp9FGNA== X-Received: by 2002:a17:906:4c4c:: with SMTP id d12mr634371ejw.491.1600881766215; Wed, 23 Sep 2020 10:22:46 -0700 (PDT) Received: from mail-ed1-f54.google.com (mail-ed1-f54.google.com. [209.85.208.54]) by smtp.gmail.com with ESMTPSA id b25sm466485ejc.75.2020.09.23.10.22.45 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 23 Sep 2020 10:22:45 -0700 (PDT) Received: by mail-ed1-f54.google.com with SMTP id b12so536512edz.11 for ; Wed, 23 Sep 2020 10:22:45 -0700 (PDT) X-Received: by 2002:a19:e00a:: with SMTP id x10mr292377lfg.603.1600881423494; Wed, 23 Sep 2020 10:17:03 -0700 (PDT) MIME-Version: 1.0 References: <20200921211744.24758-1-peterx@redhat.com> <20200921211744.24758-4-peterx@redhat.com> In-Reply-To: <20200921211744.24758-4-peterx@redhat.com> From: Linus Torvalds Date: Wed, 23 Sep 2020 10:16:47 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH 3/5] mm: Rework return value for copy_one_pte() To: Peter Xu Cc: Linux-MM , Linux Kernel Mailing List , Jason Gunthorpe , Andrew Morton , Jan Kara , Michal Hocko , Kirill Tkhai , Kirill Shutemov , Hugh Dickins , Christoph Hellwig , Andrea Arcangeli , John Hubbard , Oleg Nesterov , Leon Romanovsky , Jann Horn Content-Type: multipart/mixed; boundary="000000000000938f2505affe4062" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --000000000000938f2505affe4062 Content-Type: text/plain; charset="UTF-8" On Mon, Sep 21, 2020 at 2:18 PM Peter Xu wrote: > > There's one special path for copy_one_pte() with swap entries, in which > add_swap_count_continuation(GFP_ATOMIC) might fail. In that case we'll return > the swp_entry_t so that the caller will release the locks and redo the same > thing with GFP_KERNEL. > > It's confusing when copy_one_pte() must return a swp_entry_t (even if all the > ptes are non-swap entries). More importantly, we face other requirement to > extend this "we need to do something else, but without the locks held" case. > > Rework the return value into something easier to understand, as defined in enum > copy_mm_ret. We'll pass the swp_entry_t back using the newly introduced union > copy_mm_data parameter. Ok, I'm reading this series, and I do hate this. And I think it's unnecessary. There's a very simple way to avoid this all: split out the "!pte_present(pte)" case from the function entirely. That actually makes the code much more legible: that non-present case is very different, and it's also unlikely() and causes deeper indentation etc. Because it's unlikely, it probably also shouldn't be inline. That unlikely case is also why when then have that special "out_set_pte" label, which should just go away and be copied into the (now uninlined) function. Once that re-organization has been done, the second step is to then just move the "pte_present()" check into the caller, and suddenly all the ugly return value games will go entirely away. I'm attaching the two patches that do this here, but I do want to note how that first patch is much more legible with "--ignore-all-space", and then you really see that the diff is a _pure_ code movement thing. Otherwise it looks like it's doing a big change. Comments? NOTE! The intent here is that now we can easily add new argument (a pre-allocated page or NULL) and a return value to "copy_present_page()": it can return "I needed a temporary page but you hadn't allocated one yet" or "I used up the temporary page you gave me" or "all good, keep the temporary page around for the future". But these two patches are very intentionally meant to be just "this clearly changes NO semantics at all". Linus --000000000000938f2505affe4062 Content-Type: text/x-patch; charset="US-ASCII"; name="0001-mm-split-out-the-non-present-case-from-copy_one_pte.patch" Content-Disposition: attachment; filename="0001-mm-split-out-the-non-present-case-from-copy_one_pte.patch" Content-Transfer-Encoding: base64 Content-ID: X-Attachment-Id: f_kffng9fx0 RnJvbSBkZjNhNTdkMWY2MDcyZDA3OTc4YmFmYTdkYmQ5OTA0Y2RmOGYzZTEzIE1vbiBTZXAgMTcg MDA6MDA6MDAgMjAwMQpGcm9tOiBMaW51cyBUb3J2YWxkcyA8dG9ydmFsZHNAbGludXgtZm91bmRh dGlvbi5vcmc+CkRhdGU6IFdlZCwgMjMgU2VwIDIwMjAgMDk6NTY6NTkgLTA3MDAKU3ViamVjdDog W1BBVENIIDEvMl0gbW06IHNwbGl0IG91dCB0aGUgbm9uLXByZXNlbnQgY2FzZSBmcm9tIGNvcHlf b25lX3B0ZSgpCgpUaGlzIGlzIGEgcHVyZWx5IG1lY2hhbmljYWwgc3BsaXQgb2YgdGhlIGNvcHlf b25lX3B0ZSgpIGZ1bmN0aW9uLiAgSXQncwpub3QgaW1tZWRpYXRlbHkgb2J2aW91cyB3aGVuIGxv b2tpbmcgYXQgdGhlIGRpZmYgYmVjYXVzZSBvZiB0aGUKaW5kZW50YXRpb24gY2hhbmdlLCBidXQg dGhlIHdheSB0byBzZWUgd2hhdCBpcyBnb2luZyBvbiBpbiB0aGlzIGNvbW1pdAppcyB0byB1c2Ug dGhlICItdyIgZmxhZyB0byBub3Qgc2hvdyBwdXJlIHdoaXRlc3BhY2UgY2hh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0JCQkJbWFrZV9kZXZpY2VfcHJpdmF0ZV9l bnRyeV9yZWFkKCZlbnRyeSk7Ci0JCQkJcHRlID0gc3dwX2VudHJ5X3RvX3B0ZShlbnRyeSk7Ci0J CQkJaWYgKHB0ZV9zd3BfdWZmZF93cCgqc3JjX3B0ZSkpCi0JCQkJCXB0ZSA9IHB0ZV9zd3BfbWt1 ZmZkX3dwKHB0ZSk7Ci0JCQkJc2V0X3B0ZV9hdChzcmNfbW0sIGFkZHIsIHNyY19wdGUsIHB0ZSk7 Ci0JCQl9Ci0JCX0KLQkJZ290byBvdXRfc2V0X3B0ZTsKLQl9CisJaWYgKHVubGlrZWx5KCFwdGVf cHJlc2VudChwdGUpKSkKKwkJcmV0dXJuIGNvcHlfbm9ucHJlc2VudF9wdGUoZHN0X21tLCBzcmNf bW0sCisJCQkJCSAgIGRzdF9wdGUsIHNyY19wdGUsIHZtYSwKKwkJCQkJICAgYWRkciwgcnNzKTsK IAogCS8qCiAJICogSWYgaXQncyBhIENPVyBtYXBwaW5nLCB3cml0ZSBwcm90ZWN0IGl0IGJvdGgK QEAgLTgwNyw3ICs4MjAsNiBAQCBjb3B5X29uZV9wdGUoc3RydWN0IG1tX3N0cnVjdCAqZHN0X21t LCBzdHJ1Y3QgbW1fc3RydWN0ICpzcmNfbW0sCiAJCXJzc1ttbV9jb3VudGVyKHBhZ2UpXSsrOwog CX0KIAotb3V0X3NldF9wdGU6CiAJc2V0X3B0ZV9hdChkc3RfbW0sIGFkZHIsIGRzdF9wdGUsIHB0 ZSk7CiAJcmV0dXJuIDA7CiB9Ci0tIAoyLjI4LjAuMjE4LmdjMTJlZjNkMzQ5Cgo= --000000000000938f2505affe4062 Content-Type: text/x-patch; charset="US-ASCII"; name="0002-mm-move-the-copy_one_pte-pte_present-check-into-the-.patch" Content-Disposition: attachment; filename="0002-mm-move-the-copy_one_pte-pte_present-check-into-the-.patch" Content-Transfer-Encoding: base64 Content-ID: X-Attachment-Id: f_kffngcol1 RnJvbSA3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