Received: by 2002:a05:6a10:6006:0:0:0:0 with SMTP id w6csp456127pxa; Thu, 27 Aug 2020 07:02:15 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxVhvFy5jLTajp3HPVYkuX0vEBDipMssPgESX8vWIFW5WqN/lNlNYR3PtwPHkfjz0YM3iXJ X-Received: by 2002:a50:fa94:: with SMTP id w20mr20834234edr.82.1598536935754; Thu, 27 Aug 2020 07:02:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1598536935; cv=none; d=google.com; s=arc-20160816; b=o7T8Qmia5dTXZCY9kLBqedlYmEnZz1T6hZkVXu2gfhY3VgLQLrDJW9Vfs69OjiaiYi wIXSCyVurU9rUboOhB9FcnFUQ5KJIGo5AsD46wkvGv09YUCj2aHrLELLvn5TEimf8rHE gJHSUE4ASrhV7SP7SKSGd5bAdPi1lv45iFGP0RJ6EEbcj0uTbgdtr/N1bBuR93kYIx+b B+7pCRJAwBqQP+dW0GzzQX185Etyl2CGEKZPjMAncp8Z6UBarV5EVYB8yGo2YU/QQAhC 8XVam2ZegxOvjZKACUKyaelsls6AJJThnJzto0uKJ1m9vBkMgZAUhX2eyjPrgzfeU+rF Y0tQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=2Kk8XkOEjoFfjQLTMmrQMDxEhhyRR0DGDlDKejaKVl8=; b=ZtSVbS7+ROJUp54ejxAz5jfT3q1zm6FuL/gkfWiukx/Bn0aliql4XfjJdDt56EzZt7 s1v8YVjWf65d0swYO6Fno3pPaAa/n1qIGReE5DfZsn/6s2B1BiF1HXK79xmVQ9x21pzA QOiHTamUm5OgtHsw6F36PTfafp8xFP+7UL1wtRxHgAe+CP/bxA1EVJTru7O8Q+hlCDgz W6Yqez0ne5dWWET49RcsbCAWXb6atkNfn0wE5/b45pHyfZJMjho15Opm0LBaBR9J7qM3 yn1SUm3k2rcRVFOLok7LHLnLaaPT8midsUpFVsgT/0aqaVKqk62lt5+uwUZUH+EsLZJZ bn9g== 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 g14si1458869ejr.420.2020.08.27.07.01.51; Thu, 27 Aug 2020 07:02:15 -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 S1727910AbgH0N6g (ORCPT + 99 others); Thu, 27 Aug 2020 09:58:36 -0400 Received: from outbound-smtp46.blacknight.com ([46.22.136.58]:53063 "EHLO outbound-smtp46.blacknight.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726803AbgH0Nnz (ORCPT ); Thu, 27 Aug 2020 09:43:55 -0400 X-Greylist: delayed 505 seconds by postgrey-1.27 at vger.kernel.org; Thu, 27 Aug 2020 09:43:54 EDT Received: from mail.blacknight.com (pemlinmail01.blacknight.ie [81.17.254.10]) by outbound-smtp46.blacknight.com (Postfix) with ESMTPS id 0F2FFFAF62 for ; Thu, 27 Aug 2020 14:35:25 +0100 (IST) Received: (qmail 15080 invoked from network); 27 Aug 2020 13:35:24 -0000 Received: from unknown (HELO techsingularity.net) (mgorman@techsingularity.net@[84.203.16.65]) by 81.17.254.9 with ESMTPSA (AES256-SHA encrypted, authenticated); 27 Aug 2020 13:35:24 -0000 Date: Thu, 27 Aug 2020 14:35:23 +0100 From: Mel Gorman To: Joonsoo Kim Cc: Vlastimil Babka , Andrew Morton , Linux Memory Management List , LKML , Michal Hocko , "Aneesh Kumar K . V" , kernel-team@lge.com, Joonsoo Kim Subject: Re: [PATCH for v5.9] mm/page_alloc: handle a missing case for memalloc_nocma_{save/restore} APIs Message-ID: <20200827133523.GC3090@techsingularity.net> References: <1598331582-19923-1-git-send-email-iamjoonsoo.kim@lge.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-15 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Aug 26, 2020 at 02:12:44PM +0900, Joonsoo Kim wrote: > > > 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. I prefer the pcp bypass approach. It's simpler and it does not incur a pcp drain/refill penalty. > 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. I guess your concern is that under some circumstances that a request that passes a watermark check could fail due to a highatomic reserve and to an extent this is true. However, in that case the system is already low on memory depending on the allocation context, the pcp lists may get flushed anyway. > 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. It's not guaranteed because CMA pages could be freed between the nocma save and restore triggering further drains due to a reschedule. Similarly, a CMA allocation in parallel could refill with CMA pages on the per-cpu list. While both cases are unlikely, it's more unpredictable than a straight-forward pcp bypass. I don't really see it as a layering violation of the API because all order-0 pages go through the PCP lists. The fact that order-0 is serviced from the pcp list is an internal implementation detail, the API doesn't care. -- Mel Gorman SUSE Labs