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=-2.4 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,USER_AGENT_SANE_1 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 3146BC432C3 for ; Wed, 13 Nov 2019 18:52:08 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 4972620658 for ; Wed, 13 Nov 2019 18:52:08 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="FYS3+6Fq" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 4972620658 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 820F86B0006; Wed, 13 Nov 2019 13:52:07 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 7CFC86B0008; Wed, 13 Nov 2019 13:52:07 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 672686B000A; Wed, 13 Nov 2019 13:52:07 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0035.hostedemail.com [216.40.44.35]) by kanga.kvack.org (Postfix) with ESMTP id 4D3CB6B0006 for ; Wed, 13 Nov 2019 13:52:07 -0500 (EST) Received: from smtpin10.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with SMTP id EB90C52AA for ; Wed, 13 Nov 2019 18:52:06 +0000 (UTC) X-FDA: 76152149052.10.cup39_1261278edec5e X-HE-Tag: cup39_1261278edec5e X-Filterd-Recvd-Size: 9777 Received: from us-smtp-delivery-1.mimecast.com (us-smtp-1.mimecast.com [205.139.110.61]) by imf48.hostedemail.com (Postfix) with ESMTP for ; Wed, 13 Nov 2019 18:52:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1573671125; 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:openpgp:openpgp:autocrypt:autocrypt; bh=JRmUXl7vlLE1wg3r3Nay/eMd0Xij3JTYbdEZvOB7wb4=; b=FYS3+6FqKT/Qzbw4qudiHoFtbIP5EKJHIDRQrrT3QwciTkEFw+hLh0rVVvFFazmfNAQMSZ 0FNcX7miL88N+ValCfTWEwivHDJtWiDGmGaGlUf84ZzIS780n39y364N5oEqEgM1sIg7Vg xYqa6Wi5hDnfEbR8CkeRQ6jy7K/0pPY= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-184-XMyZxc0_PyGuV-PurGNZ9w-1; Wed, 13 Nov 2019 13:52:03 -0500 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id C5A71477; Wed, 13 Nov 2019 18:52:01 +0000 (UTC) Received: from [10.40.204.128] (ovpn-204-128.brq.redhat.com [10.40.204.128]) by smtp.corp.redhat.com (Postfix) with ESMTPS id BD4747D8C5; Wed, 13 Nov 2019 18:51:45 +0000 (UTC) Subject: Re: + mm-introduce-reported-pages.patch added to -mm tree To: Alexander Duyck , David Hildenbrand , Michal Hocko Cc: akpm@linux-foundation.org, aarcange@redhat.com, dan.j.williams@intel.com, dave.hansen@intel.com, konrad.wilk@oracle.com, lcapitulino@redhat.com, mgorman@techsingularity.net, mm-commits@vger.kernel.org, mst@redhat.com, osalvador@suse.de, pagupta@redhat.com, pbonzini@redhat.com, riel@surriel.com, vbabka@suse.cz, wei.w.wang@intel.com, willy@infradead.org, yang.zhang.wz@gmail.com, linux-mm@kvack.org References: <20191106121605.GH8314@dhcp22.suse.cz> <20191106165416.GO8314@dhcp22.suse.cz> <4cf64ff9-b099-d50a-5c08-9a8f3a2f52bf@redhat.com> <131f72aa-c4e6-572d-f616-624316b62842@redhat.com> <1d881e86ed58511b20883fd0031623fe6cade480.camel@linux.intel.com> <8a407188-5dd2-648b-fc26-f03a826bfee3@redhat.com> <4be6114f57934eb1478f84fd1358a7fcc547b248.camel@linux.intel.com> From: Nitesh Narayan Lal Openpgp: preference=signencrypt Autocrypt: addr=nitesh@redhat.com; prefer-encrypt=mutual; keydata= mQINBFl4pQoBEADT/nXR2JOfsCjDgYmE2qonSGjkM1g8S6p9UWD+bf7YEAYYYzZsLtbilFTe z4nL4AV6VJmC7dBIlTi3Mj2eymD/2dkKP6UXlliWkq67feVg1KG+4UIp89lFW7v5Y8Muw3Fm uQbFvxyhN8n3tmhRe+ScWsndSBDxYOZgkbCSIfNPdZrHcnOLfA7xMJZeRCjqUpwhIjxQdFA7 n0s0KZ2cHIsemtBM8b2WXSQG9CjqAJHVkDhrBWKThDRF7k80oiJdEQlTEiVhaEDURXq+2XmG jpCnvRQDb28EJSsQlNEAzwzHMeplddfB0vCg9fRk/kOBMDBtGsTvNT9OYUZD+7jaf0gvBvBB lbKmmMMX7uJB+ejY7bnw6ePNrVPErWyfHzR5WYrIFUtgoR3LigKnw5apzc7UIV9G8uiIcZEn C+QJCK43jgnkPcSmwVPztcrkbC84g1K5v2Dxh9amXKLBA1/i+CAY8JWMTepsFohIFM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GbB2dAA/QmbA+Q+Xuamzm/1imigz6L6sOt2n/X/SSc33w8RJUyor SvAIoG/zU2Y76pKTgbpQqMDmkmNYFMLcAukpvC4ki3Sf086TdMgkjqtnpTkEElMSFJC8npXv 3QnGGOIfFug/qs8z03DLPBz9VYS26jiiN7QIJVpeeEdN/LKnaz5LO+h5kNAyj44qdF2T2AiF HxnZnxO5JNP5uISQH3FjxxGxJkdJ8jKzZV7aT37sC+Rp0o3KNc+GXTR+GSVq87Xfuhx0LRST NK9ZhT0+qkiN7npFLtNtbzwqaqceq3XhafmCiw8xrtzCnlB/C4SiBr/93Ip4kihXJ0EuHSLn VujM7c/b4pps Organization: Red Hat Inc, Message-ID: <031b8188-ce01-41cf-7c96-f611727faa35@redhat.com> Date: Wed, 13 Nov 2019 13:51:42 -0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0 MIME-Version: 1.0 In-Reply-To: <4be6114f57934eb1478f84fd1358a7fcc547b248.camel@linux.intel.com> Content-Language: en-US X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-MC-Unique: XMyZxc0_PyGuV-PurGNZ9w-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: On 11/12/19 1:34 PM, Alexander Duyck wrote: > On Tue, 2019-11-12 at 14:04 +0100, David Hildenbrand wrote: >>>>> fact is it is still invasive, just to different parts of the mm subsy= stem. >>>> I'd love to see how it uses the page isolation framework, and only has= a=20 >>>> single hook to queue pages. I don't like the way pages are pulled out = of=20 >>>> the buddy in Niteshs approach currently. What you have is cleaner. >>> I don't see how you could use the page isolation framework to pull out >>> free pages. Is there a thread somewhere on the topic that I missed? >> It's basically only isolating pages while reporting them, and not >> pulling them out of the buddy (IOW, you move the pages to the isolate >> queues where nobody is allowed to touch them, and setting the >> migratetype properly). This e.g., makes other user of page isolation >> (e.g., memory offlining, alloc_contig_range()) play nicely with these >> isolated pages. "somebody else just isolated them, please try again." > How so? If I understand correctly there isn't anything that prevents you > from isolating an already isolated page, is there? Last I knew isolated > pages are still considered "movable" since they are still buddy pages > aren't they? > > Also this seems like it would have other implications since isolating a > page kicks of the memory notifier so as a result a balloon driver would > then free the pages back out so that they could be isolated with the > assumption the region is going offline. > >> start_isolate_page_range()/undo_isolate_page_range()/test_pages_isolated= () >> along with a lockless check if the page is free. > Okay, that part I think I get. However doesn't all that logic more or les= s > ignore the watermarks? It seems like you could cause an OOM if you don't > have the necessary checks in place for that. > >> I think it should be something like this (ignoring different >> migratetypes and such for now) >> >> 1. Test lockless if page is free: Not free? Done. > So this should help to reduce the liklihood of races in the steps below. > However it might also be useful if the code had some other check to see i= f > it was done other than just making a pass through the bitmap. > > One thing I had brought up with Nitesh was the idea of maybe doing some > sort of RCU bitmap type approach. Basically while we hold the zone lock w= e > could swap out the old bitmap for a new one. We could probably even keep = a > counter at the start of the structure so that we could track how many bit= s > are actually set there. Then it becomes less likely of having a race wher= e > you free a page and set the bit and the hinting thread tests and clears > the bit but doesn't see the freed page since it is not synchronized. > Otherwise your notification setup and reporting thread may need a few smp > barriers added where necessary. > > One generic request. I would appreciate it if you guys can keep me in the cc while discussing. Otherwise, with the amount of discussion its quite easy to go out of sync. --=20 Thanks Nitesh