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.2 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,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 24E21C2BB1D for ; Wed, 11 Mar 2020 17:41:45 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 887732073E for ; Wed, 11 Mar 2020 17:41:45 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 887732073E Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=suse.cz Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 73EBA6B0003; Wed, 11 Mar 2020 13:41:44 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 6EF2A6B0005; Wed, 11 Mar 2020 13:41:44 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 604CE6B0006; Wed, 11 Mar 2020 13:41:44 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0206.hostedemail.com [216.40.44.206]) by kanga.kvack.org (Postfix) with ESMTP id 4AEBD6B0003 for ; Wed, 11 Mar 2020 13:41:44 -0400 (EDT) Received: from smtpin30.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id 0962C4DA1 for ; Wed, 11 Mar 2020 17:41:44 +0000 (UTC) X-FDA: 76583798928.30.time64_494c59c857c0f X-HE-Tag: time64_494c59c857c0f X-Filterd-Recvd-Size: 3759 Received: from mx2.suse.de (mx2.suse.de [195.135.220.15]) by imf34.hostedemail.com (Postfix) with ESMTP for ; Wed, 11 Mar 2020 17:41:43 +0000 (UTC) X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id B2BD2AE6F; Wed, 11 Mar 2020 17:41:40 +0000 (UTC) Subject: Re: [PATCH] mm,page_alloc,cma: conditionally prefer cma pageblocks for movable allocations To: Joonsoo Kim Cc: Rik van Riel , Andrew Morton , Linux Memory Management List , LKML , kernel-team@fb.com, Roman Gushchin , Qian Cai , Mel Gorman , Anshuman Khandual , Joonsoo Kim References: <20200306150102.3e77354b@imladris.surriel.com> <8e67d88f-3ec8-4795-35dc-47e3735e530e@suse.cz> From: Vlastimil Babka Message-ID: <89865b7b-f0ed-999d-0f23-4dbfb45115db@suse.cz> Date: Wed, 11 Mar 2020 18:41:38 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.5.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit 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 3/11/20 11:13 AM, Joonsoo Kim wrote: >> >> Few years ago Joonsoo wanted to fix these kinds of weird MIGRATE_CMA corner >> cases by using ZONE_MOVABLE instead [1]. Unfortunately it was reverted due to >> unresolved bugs. Perhaps the idea could be resurrected now? >> >> [1] >> https://lore.kernel.org/linux-mm/1512114786-5085-1-git-send-email-iamjoonsoo.kim@lge.com/ > > Thanks for ccing, Vlastimil. No problem. Also, welcome back :) > Recently, I'm working for resurrecting this idea. > I will send the preparation patches in this or next week. Good to hear! > Unresolved bugs of my patchset comes from the fact that ZONE_MOVABLE > which is used for > serving CMA memory in my patchset could have both lowmem(direct mapped) and > highmem(no direct mapped) pages on CONFIG_HIGHMEM enabled system. > > For someone to use this memory, PageHighMem() should be called to > check if there is direct > mapping or not. Current PageHighMem() implementation is: > > #define PageHighMem(__p) is_highmem_idx(page_zonenum(__p)) > > Since ZONE_MOVABLE has both typed pages, ZONE_MOVABLE should be considered > as highmem zone. In this case, PageHighMem() always returns TRUE for > all pages on > ZONE_MOVABLE and lowmem pages on ZONE_MOVABLE could make some troubles. Doh, HighMem brings only troubles these days [1]. [1] https://lwn.net/Articles/813201/ > My plan to fix this problem is to change the PageHighMem() implementation. > > #define PageHighMem(__p) (page_to_pfn(__p) >= max_low_pfn) > > In fact, PageHighMem() is used to check whether direct mapping exists or not. > With this new implementation, regardless of the zone type of the page, we can > correctly check if the page is direct mapped or not. Changing the > name, PageHighMem(), > to !PageDirectMapped() is also planned but it will be done after > everything have settle down. > > Unfortunately, before changing the implementation, I should check the > all call-sites > of PageHighMem() since there is some callers who use PageHighMem() to check > the zone type. > > What my preparation patch will does is to correct this PageHighMem() usage. > After fixing it, I will try to merge the patchset [1]. > > Thanks. >