Received: by 2002:a05:6a10:6006:0:0:0:0 with SMTP id w6csp404033pxa; Thu, 27 Aug 2020 05:48:47 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwPNcLHpovS9hNdq8P7vhJjjniel+A/okb6ypDyq0XxpNI8xpDYreZlgUIzOzvUpj4Cnmd/ X-Received: by 2002:a05:6402:748:: with SMTP id p8mr20555108edy.305.1598532527773; Thu, 27 Aug 2020 05:48:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1598532527; cv=none; d=google.com; s=arc-20160816; b=Rk3eWVWK84DIHSjIskPQBDXsECdoeknIQD8Dcm61piMFpFq16t6eIsl9MW7yTZKmva LTPhSkMSnzxF24BFfBUR/fjgLmhDmKWqjOdBWUGfP+LRRCP3bLmeLdw7J3a+TiaI3QNB 7ra39aiqbAYQXt6gDy8Y7PLE1YP/J0nDo00bCZedPDCgyMPi+0snbiIHrTO1Hx2TM+a8 QjvuE91RS206/Kll+CpbfS2cUNjyUSLtMk/GvwDnJUKgyDl/+xy7SNdl237DSO2PRGWW gliW54OB4ogeCiyyIEXzMGPfVzh05nfDArW8WdtbDzuDypv5fGg0XsjaW4DNG+wk2C4P xOWQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject; bh=wsrSta0pY9tT98Pnr5YaXsdBPbMS5SMcsDJ61XTbB20=; b=veMwXI4Vgt4pKC0jhKlJCygcc9h7L9PF5lm67kjcZkvAbCdNqnd0nMV5RQ239h2eSf QSlMWspH3/mWo++dPICIQLjy8ybOzRY8Jc3g60b7/ItmYkeX6aQKPDSmxDAjOdOGLBZy YKicFSBNY+fE9knS+8FQuGPIhvCJt6biJw3UTw2yVVjiDrzpUt6iX+FU/7jn9bvG3v4F diLn9TGBWt9SdebRCGCavFZduI4yjfXVmaZ31SP0F3I6llM/sgz60Zg47I+KAiGrDbsI 3yhusb/LLrLb6gZODB+9rQoOV1nTpjZ3oPhAawCaAF1SAlqdzgyPJ35zhChNGuTH/Cyn xYAw== ARC-Authentication-Results: i=1; mx.google.com; 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 q16si1308063eji.340.2020.08.27.05.48.23; Thu, 27 Aug 2020 05:48:47 -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; 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 S1729153AbgH0MrZ (ORCPT + 99 others); Thu, 27 Aug 2020 08:47:25 -0400 Received: from mx2.suse.de ([195.135.220.15]:52164 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728830AbgH0MeH (ORCPT ); Thu, 27 Aug 2020 08:34:07 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 11DF2AD63; Thu, 27 Aug 2020 12:16:31 +0000 (UTC) Subject: Re: [PATCH for v5.9] mm/page_alloc: handle a missing case for memalloc_nocma_{save/restore} APIs To: Joonsoo Kim Cc: Andrew Morton , Linux Memory Management List , LKML , Michal Hocko , "Aneesh Kumar K . V" , kernel-team@lge.com, Joonsoo Kim , Mel Gorman References: <1598331582-19923-1-git-send-email-iamjoonsoo.kim@lge.com> From: Vlastimil Babka Message-ID: <77c6dfeb-06e9-0347-6f3d-188bb67b263c@suse.cz> Date: Thu, 27 Aug 2020 14:15:57 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.11.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 8/26/20 7:12 AM, Joonsoo Kim wrote: > 2020년 8월 25일 (화) 오후 6:43, Vlastimil Babka 님이 작성: >> >> >> On 8/25/20 6:59 AM, js1304@gmail.com wrote: >> > From: Joonsoo Kim >> > >> > memalloc_nocma_{save/restore} APIs can be used to skip page allocation >> > on CMA area, but, there is a missing case and the page on CMA area could >> > be allocated even if APIs are used. This patch handles this case to fix >> > the potential issue. >> > >> > Missing case is an allocation from the pcplist. MIGRATE_MOVABLE pcplist >> > could have the pages on CMA area so we need to skip it if ALLOC_CMA isn't >> > specified. >> > >> > This patch implements this behaviour by checking allocated page from >> > the pcplist rather than skipping an allocation from the pcplist entirely. >> > Skipping the pcplist entirely would result in a mismatch between watermark >> > check and actual page allocation. >> >> Are you sure? I think a mismatch exists already. Pages can be on the pcplist but >> they are not considered as free in the watermark check. So passing watermark >> check means there should be also pages on free lists. So skipping pcplists would >> be safe, no? > > You are right. > >> > And, it requires to break current code >> > layering that order-0 page is always handled by the pcplist. I'd prefer >> > to avoid it so this patch uses different way to skip CMA page allocation >> > from the pcplist. >> >> Well it would be much simpler and won't affect most of allocations. Better than >> flushing pcplists IMHO. > > Hmm...Still, I'd prefer my approach. There are two reasons. First, > layering problem > mentioned above. In rmqueue(), there is a code for MIGRATE_HIGHATOMIC. > As the name shows, it's for high order atomic allocation. But, after > skipping pcplist > allocation as you suggested, we could get there with order 0 request. > We can also > change this code, but, I'd hope to maintain current layering. Second, > a performance > reason. After the flag for nocma is up, a burst of nocma allocation > could come. After > flushing the pcplist one times, we can use the free page on the > pcplist as usual until > the context is changed. Both solutions are ugly and we should have CMA in ZONE_MOVABLE or get rid of it completely. Let's CC Mel what he thinks. > How about my reasoning? > > Thanks. >