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=-0.9 required=3.0 tests=DKIMWL_WL_HIGH,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 3E6D3C2D0CD for ; Tue, 17 Dec 2019 18:46:54 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id E8B6F21582 for ; Tue, 17 Dec 2019 18:46:53 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="ikLIMO5P" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org E8B6F21582 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 848FB8E009F; Tue, 17 Dec 2019 13:46:53 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 7F9388E0079; Tue, 17 Dec 2019 13:46:53 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 6E8D58E009F; Tue, 17 Dec 2019 13:46:53 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0234.hostedemail.com [216.40.44.234]) by kanga.kvack.org (Postfix) with ESMTP id 569188E0079 for ; Tue, 17 Dec 2019 13:46:53 -0500 (EST) Received: from smtpin16.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with SMTP id E8E564820 for ; Tue, 17 Dec 2019 18:46:52 +0000 (UTC) X-FDA: 76275515064.16.dad30_3c084b0e71c04 X-HE-Tag: dad30_3c084b0e71c04 X-Filterd-Recvd-Size: 6184 Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [205.139.110.120]) by imf35.hostedemail.com (Postfix) with ESMTP for ; Tue, 17 Dec 2019 18:46:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1576608411; 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=0ufuAb5W0GfjJpkK8MkL9c8dWcfoO5q/meSbINFYiCg=; b=ikLIMO5P3mkdMNZ/odyO7Le840LsQ7lZd4rjlUhxtnps7sjk8EZGyk2bWEpWqraER1ob1Q Lyz1f1BtJqE3hP+g7hrKThZ8XEsRifOEB5fbQOJCqD1ll1hyO5h13V7SpE4sYr4pfs/sM7 UZ966q7ExjpeM0BLVAEFxf8DfmcKh70= Received: from mail-wm1-f70.google.com (mail-wm1-f70.google.com [209.85.128.70]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-236-RXYhnOrDMc-XTsnDGA_Z2w-1; Tue, 17 Dec 2019 13:46:50 -0500 Received: by mail-wm1-f70.google.com with SMTP id b9so1222957wmj.6 for ; Tue, 17 Dec 2019 10:46:49 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:content-transfer-encoding:from:mime-version :subject:date:message-id:references:cc:in-reply-to:to; bh=IZjRKmHuvnoVKMirbirXU2qUqtR+sRTFhW7hH7QT1ZU=; b=Ev8GWZb7lQrBu0yNGXeYIi78BfhLCGHHNbxB3iUiBkzJYg1RaL9gpFqib3k4Efge5m hjkypClR8Sy73Tqcpe3urZX1OXW71EbtSG3WFzpcMnBehJ0cpGj98VFg9hylz1XJMrum 8dby1OEHm+cBC2sVrE+NYSYznDEJqb6VlPB2RBfRoIuWiHqsY0H1zSMFryejl94tjV10 yl/0CFVxJ/WJ4uy80bcONDpTRaJ/GRa1YsgbaWNeEOLg46g0yxZkAMz6psEqXcfnj1v0 mq12MlRKB0zQNyLHzHDhkvTSuMhAiakpbwqu6g1ATRqHpJ+6fAu/eQn1qWcuAWEfb5KL pYYA== X-Gm-Message-State: APjAAAVmVwF0INCvgCUaN96tAe3a/pQB/zk4XsqRwNwEFSUwfqDWoNk7 Koc8d97eeEX3O1aDBWn8XByoJXkKLiS2sMTZ6qB10onsjZswmxqvJSf0HMvkHfdpnOaAJOPwmS/ fjWNrfDuei20= X-Received: by 2002:a5d:6708:: with SMTP id o8mr39021281wru.296.1576608408738; Tue, 17 Dec 2019 10:46:48 -0800 (PST) X-Google-Smtp-Source: APXvYqwPvlk+TwbhCe+kHYv7eZKZShKxj66b/JxKprHybJXtulfbUtBwnBztokfND3OEGYr34Cq8KA== X-Received: by 2002:a5d:6708:: with SMTP id o8mr39021257wru.296.1576608408527; Tue, 17 Dec 2019 10:46:48 -0800 (PST) Received: from [192.168.3.122] (p5B0C64F3.dip0.t-ipconnect.de. [91.12.100.243]) by smtp.gmail.com with ESMTPSA id g25sm3943341wmh.3.2019.12.17.10.46.47 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 17 Dec 2019 10:46:47 -0800 (PST) From: David Hildenbrand Mime-Version: 1.0 (1.0) Subject: Re: [PATCH v15 3/7] mm: Add function __putback_isolated_page Date: Tue, 17 Dec 2019 19:46:47 +0100 Message-Id: <08EFF184-E727-4A79-ABEF-52F2463860C3@redhat.com> References: <1a6e4646f570bf193924e099557841eb6e77a80d.camel@linux.intel.com> Cc: David Hildenbrand , Alexander Duyck , kvm@vger.kernel.org, mst@redhat.com, linux-kernel@vger.kernel.org, willy@infradead.org, mhocko@kernel.org, linux-mm@kvack.org, akpm@linux-foundation.org, mgorman@techsingularity.net, vbabka@suse.cz, yang.zhang.wz@gmail.com, nitesh@redhat.com, konrad.wilk@oracle.com, pagupta@redhat.com, riel@surriel.com, lcapitulino@redhat.com, dave.hansen@intel.com, wei.w.wang@intel.com, aarcange@redhat.com, pbonzini@redhat.com, dan.j.williams@intel.com, osalvador@suse.de In-Reply-To: <1a6e4646f570bf193924e099557841eb6e77a80d.camel@linux.intel.com> To: Alexander Duyck X-Mailer: iPhone Mail (17A878) X-MC-Unique: RXYhnOrDMc-XTsnDGA_Z2w-1 X-Mimecast-Spam-Score: 0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable 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: > Am 17.12.2019 um 19:25 schrieb Alexander Duyck : >=20 > =EF=BB=BFOn Tue, 2019-12-17 at 18:24 +0100, David Hildenbrand wrote: >>>>> Also there are some scenarios where __page_to_pfn is not that simple = a >>>>> call with us having to get the node ID so we can find the pgdat struc= ture >>>>> to perform the calculation. I'm not sure the compiler would be ble to >>>>> figure out that the result is the same for both calls, so it is bette= r to >>>>> make it explicit. >>>>=20 >>>> Only in case of CONFIG_SPARSEMEM we have to go via the section - but I >>>> doubt this is really worth optimizing here. >>>>=20 >>>> But yeah, I'm fine with this change, only "IMHO >>>> get_pageblock_migratetype() would be nicer" :) >>>=20 >>> Aren't most distros running with CONFIG_SPARSEMEM enabled? If that is t= he >>> case why not optimize for it? >>=20 >> Because I tend to dislike micro-optimizations without performance >> numbers for code that is not on a hot path. But I mean in this case, as >> you said, you need the pfn either way, so it's completely fine with. >>=20 >> I do wonder, however, if you should just pass in the migratetype from >> the caller. That would be even faster ;) >=20 > The problem is page isolation. We can end up with a page being moved to a= n > isolate pageblock while we aren't holding the zone lock, and as such we > likely need to test it again anyway. So there isn't value in storing and > reusing the value for cases like page reporting. >=20 > In addition, the act of isolating the page can cause the migratetype to > change as __isolate_free_page will attempt to change the migratetype to > movable if it is one of the standard percpu types and we are pulling at > least half a pageblock out. So storing the value before we isolate it > would be problematic as well. >=20 > Undoing page isolation is the exception to the issues pointed out above, > but in that case we are overwriting the pageblock migratetype anyway so > the cache lines involved should all be warm from having just set the > value. Nothing would speak against querying the migratetype in the caller and pass= ing it on. After all you=E2=80=98re holding the zone lock, so it can=E2=80= =98t change. >=20