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 mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 58C9FC433FE for ; Tue, 16 Nov 2021 05:06:46 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id DC3D3614C8 for ; Tue, 16 Nov 2021 05:06:45 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org DC3D3614C8 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=kvack.org Received: by kanga.kvack.org (Postfix) id 5950E6B00AD; Tue, 16 Nov 2021 00:06:45 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 5431C6B00AE; Tue, 16 Nov 2021 00:06:45 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 40ADC6B00AF; Tue, 16 Nov 2021 00:06:45 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0036.hostedemail.com [216.40.44.36]) by kanga.kvack.org (Postfix) with ESMTP id 3209A6B00AD for ; Tue, 16 Nov 2021 00:06:45 -0500 (EST) Received: from smtpin30.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id EC2AE82D8F for ; Tue, 16 Nov 2021 05:06:44 +0000 (UTC) X-FDA: 78813608328.30.0551B9F Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by imf16.hostedemail.com (Postfix) with ESMTP id 0AF75F00008E for ; Tue, 16 Nov 2021 05:06:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1637039203; 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=AuzOVY/lauvGexWGkWrAO1q71UBvsei/aBKW+iGdLQ4=; b=At64RCv3EZBTToG4+884ScIljK8DgIVxRXmTWcG6lpwtHSCA5JeazyksmQOy1Y3GPJk5wQ 5nYyp57hQTP5M25qEUP4dal0eksxa75vdd3LDN2xgASqKjL/nX/pZt1OJBjswUMMmQfTNK pteUkQu7LzAhy/EnhxjGEWB2vEugmsk= Received: from mail-pg1-f198.google.com (mail-pg1-f198.google.com [209.85.215.198]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-565-6eFY7GRkMkaUIYD-zoUXiw-1; Tue, 16 Nov 2021 00:06:39 -0500 X-MC-Unique: 6eFY7GRkMkaUIYD-zoUXiw-1 Received: by mail-pg1-f198.google.com with SMTP id u6-20020a63f646000000b002dbccd46e61so10138704pgj.18 for ; Mon, 15 Nov 2021 21:06:39 -0800 (PST) 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=AuzOVY/lauvGexWGkWrAO1q71UBvsei/aBKW+iGdLQ4=; b=C4QawxbNY5hfKu1xTlJd1opizNWcD6eUCZAqmR/xBRSZuMgf30Fm7bH/mvN6YCg50c 2Dbgwg0xU3R1Ah9MKxv7JAobCghSlxjp0xSpBwRIyIfs63kgIKRpUCRl1oCLxKmxab7Q Z+EfD87sdHTbDR3lVZ9xocI+u2MFOuiUZ0J7MM3aN13OSszD+B/4qMrYyRiyBM+DW0Rv q4S9Gtw3PrxgNDIG8+km4wyKcMU6T1Ed9LnFhvRFgBXghwh2iNhvZcxVJt7A7vmS2vLO HH5OHJS26Ief66+GkUJsMJhwo+pMoaBJgDZRcrjM6a7D8ZAHivJ7/t5uOi/m67wtw4Mg moEg== X-Gm-Message-State: AOAM531xmMxk+uVJQqt1gVIowiPP65Kmb1yKoWxcTHo60109ERd9HMrq Gu8iNqBN//fLTJgxXP+CZ8d1Sb5opBasqU/9qdZvS+DmLYtpVV8QKb7O1It0pot037zjWw5JtV5 fY6hnnrc9mGo= X-Received: by 2002:a63:f70a:: with SMTP id x10mr3103349pgh.12.1637039198545; Mon, 15 Nov 2021 21:06:38 -0800 (PST) X-Google-Smtp-Source: ABdhPJx79zlYcM3aNI5NxvJzl0JyITbzxDW6jQYt5RMsN04A1pwcOL73bXYgTKif8jzEGiaR2hd0uw== X-Received: by 2002:a63:f70a:: with SMTP id x10mr3103328pgh.12.1637039198279; Mon, 15 Nov 2021 21:06:38 -0800 (PST) Received: from xz-m1.local ([191.101.132.59]) by smtp.gmail.com with ESMTPSA id kx3sm914236pjb.5.2021.11.15.21.06.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 15 Nov 2021 21:06:37 -0800 (PST) Date: Tue, 16 Nov 2021 13:06:30 +0800 From: Peter Xu To: Matthew Wilcox Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org, David Hildenbrand , Andrea Arcangeli , Yang Shi , Vlastimil Babka , Hugh Dickins , Andrew Morton , Alistair Popple , "Kirill A . Shutemov" Subject: Re: [PATCH RFC v2 2/2] mm: Rework swap handling of zap_pte_range Message-ID: References: <20211115134951.85286-1-peterx@redhat.com> <20211115134951.85286-3-peterx@redhat.com> MIME-Version: 1.0 In-Reply-To: X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=utf-8 Content-Disposition: inline X-Rspamd-Server: rspam05 X-Rspamd-Queue-Id: 0AF75F00008E X-Stat-Signature: x5n58p46mpdg9kkemb9qy8yn5s3hxhyp Authentication-Results: imf16.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=At64RCv3; spf=none (imf16.hostedemail.com: domain of peterx@redhat.com has no SPF policy when checking 216.205.24.124) smtp.mailfrom=peterx@redhat.com; dmarc=pass (policy=none) header.from=redhat.com X-HE-Tag: 1637039191-891305 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 Mon, Nov 15, 2021 at 01:57:32PM +0000, Matthew Wilcox wrote: > On Mon, Nov 15, 2021 at 09:49:51PM +0800, Peter Xu wrote: > > Clean the code up by merging the device private/exclusive swap entry handling > > with the rest, then we merge the pte clear operation too. > > > > struct* page is defined in multiple places in the function, move it upward. > > Is that actually a good thing? There was a time when declaring > variables more locally helped compilers with liveness analysis and > register allocation. Compilers are probably smarter now. > I see, I don't know the history of that, but I did give it a shot with a patch that recovered all the "struct page*" back to the origin, I found that it'll generated exactly the same assembly of unmap_page_range (actually, the whole mm/memory.o) no matter what. I only tested on an aarch64 system, with below gcc version: $ gcc -v Using built-in specs. COLLECT_GCC=gcc COLLECT_LTO_WRAPPER=/usr/libexec/gcc/aarch64-redhat-linux/11/lto-wrapper Target: aarch64-redhat-linux Configured with: ../configure --enable-bootstrap --enable-languages=c,c++,fortran,objc,obj-c++,ada,go,lto --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --with-bugurl=http://bugzilla.redhat.com/bugzilla --enable-shared --enable-threads=posix --enable-checking=release --enable-multilib --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-gnu-unique-object --enable-linker-build-id --with-gcc-major-version-only --with-linker-hash-style=gnu --enable-plugin --enable-initfini-array --with-isl=/builddir/build/BUILD/gcc-11.0.1-20210324/obj-aarch64-redhat-linux/isl-install --enable-gnu-indirect-function --build=aarch64-redhat-linux Thread model: posix Supported LTO compression algorithms: zlib zstd gcc version 11.0.1 20210324 (Red Hat 11.0.1-0) (GCC) Thanks, -- Peter Xu