Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp3405736pxa; Tue, 25 Aug 2020 22:16:00 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzDtQ1UhcSVnYPx75YWCUfWaPEzOvcHPDDCxwTQgLnHsjZzg+42VxHmnkLxvxanx7yhg2xV X-Received: by 2002:a17:906:410d:: with SMTP id j13mr13781896ejk.139.1598418960744; Tue, 25 Aug 2020 22:16:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1598418960; cv=none; d=google.com; s=arc-20160816; b=cJV6OJPorJHuHVCk9JjPgCQwzGD0uRLVt0O51g8rR1te1/kZz8RIwyNVXe9g26uwSC rPfiXO07ljCrVw+m4u8mJlpVxtFZLtq2wo7FvI9rLDRBNneSlX0Raslb5kIw7nEGeQwE sfv7CMOPSJVVR49vw6szNSObrKUJnWbYu//D+zGSguuARj3ZhL1p3okBKbHXoM8brkL8 68N4S7tnLXeoDx7CzNSlnFEtzvzmuH6yBwqSUAIo4aASLZ3qY8yNSEhHhEv4yRcUqQ0C gw3cUW4aPpQYIs26AYHrqcQUNkcGXqZkh9IN5JOOSv8CiuQRjCJib+dYMwJsYZDtq73x 7bfw== 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:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=yfilLBz5JZdi/avFWO9tv5bRcdRvux+Y1JNGa63+Zro=; b=yxB5YshoIybjBHRbg9ReZ3tehG5wJ8dHwRv6KOtqBK4OM34ddpVJbe1CITuKgpAncl raGUdmHxAC+1O9fELkXsr67hsAeVtlmROb6O6yLL3AIEvIhuAZQrgBnZSVAavXyTpB/d 3lvevidhIrcVr54VnJVTnPcNpTw55PMtk48T+9LsR5vfIKLGKa2/nCTwPBBv6O6HzwOG 3NY04+sZX9UY/nmfH/yhlE8nvmMGlRyWqVxvNot5WNG2Wqx/NV8t0KEwPYet9isgLuke NnKErYBNisND1HGjEy7sUxd8/1FbYygmQjThVh89/VrVX3wJ1UwaPKXrYmbZ5yY7qUPL 1wsg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=hYKvrPyv; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id y23si863716ejm.712.2020.08.25.22.15.37; Tue, 25 Aug 2020 22:16:00 -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; dkim=pass header.i=@gmail.com header.s=20161025 header.b=hYKvrPyv; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726186AbgHZFM5 (ORCPT + 99 others); Wed, 26 Aug 2020 01:12:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57152 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725764AbgHZFM4 (ORCPT ); Wed, 26 Aug 2020 01:12:56 -0400 Received: from mail-qt1-x830.google.com (mail-qt1-x830.google.com [IPv6:2607:f8b0:4864:20::830]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DFBF1C061574 for ; Tue, 25 Aug 2020 22:12:55 -0700 (PDT) Received: by mail-qt1-x830.google.com with SMTP id k18so562591qtm.10 for ; Tue, 25 Aug 2020 22:12:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=yfilLBz5JZdi/avFWO9tv5bRcdRvux+Y1JNGa63+Zro=; b=hYKvrPyvirHQ+xAzWDhhq/Ve3fZvfDkw5fuDGO3+OfWWm1ofs9zDsoDjyMvL+nPnSD gs0YfdCzHTHaFwZTQP+iqBv82s7JY+1XrsnNfWmUyj4qJF40prRBc63skwRCZJbNHsuA Me92vZt7MTLa083lH4yQNIH/6bOKrvKscPPAXJvjmhYeTA1Xguf/YUQBzFyNDYoU+3Lj vzHg4aUmM3RX451EBuADsyD3WpYoPIXv+r/3t/HK1qvwno5cQ0DT0P3qnAHKQZf7utgB zkPp/qpPx/xiQe/xa8V8yerURt0qsvUun9nocWJKFvK84ZN0zm8AXmtk2s3USdvh6xQC VHng== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=yfilLBz5JZdi/avFWO9tv5bRcdRvux+Y1JNGa63+Zro=; b=kOyprwa39/HBdd0xFkKvGfpmwwkwSn7s+RZgdoMOCCyA/hyJBnSy8Zo9TyyxUwc3L4 L/PO3kzzPBFpdVLR3N3iFzqyPJYUH65NFs9hfQPCGrDT71LR4Hyedd/uPPwMTGgVkLD8 wvlQtwCGwEN/ed5AMVC3yy+HCfbvn2Ft6jYlWA/f06ObH63SHk5sWz9TuXC83OzSQ7PA /Jmg5Te0u6LXxsuFgD7dgrR9/X3JUgZcKy5anh4Jnb0kdS+gJRyEZ6J0ymn9Y8BX/CUU cwsYB2rW9JR+4VU72hOjt70oulrfQPjAJe/fl4J6yADRZQMbW3vuWtfIXHZYtZc8YsrA Tieg== X-Gm-Message-State: AOAM533IqWIFmlAbT2HFEy7PbWBlV7OUnUDs9wUfFbhyosmJzs//Q9hI 9Be590RTN9XugbHDqahsNRies5tHz6UZCYQl3rXwOrvq X-Received: by 2002:ac8:36b4:: with SMTP id a49mr9983461qtc.124.1598418774817; Tue, 25 Aug 2020 22:12:54 -0700 (PDT) MIME-Version: 1.0 References: <1598331582-19923-1-git-send-email-iamjoonsoo.kim@lge.com> In-Reply-To: From: Joonsoo Kim Date: Wed, 26 Aug 2020 14:12:44 +0900 Message-ID: Subject: Re: [PATCH for v5.9] mm/page_alloc: handle a missing case for memalloc_nocma_{save/restore} APIs To: Vlastimil Babka Cc: Andrew Morton , Linux Memory Management List , LKML , Michal Hocko , "Aneesh Kumar K . V" , kernel-team@lge.com, Joonsoo Kim Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 2020=EB=85=84 8=EC=9B=94 25=EC=9D=BC (=ED=99=94) =EC=98=A4=ED=9B=84 6:43, V= lastimil Babka =EB=8B=98=EC=9D=B4 =EC=9E=91=EC=84=B1: > > > 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 coul= d > > 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 entirel= y. > > Skipping the pcplist entirely would result in a mismatch between waterm= ark > > check and actual page allocation. > > Are you sure? I think a mismatch exists already. Pages can be on the pcpl= ist but > they are not considered as free in the watermark check. So passing waterm= ark > check means there should be also pages on free lists. So skipping pcplist= s 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 allocatio= n > > from the pcplist. > > Well it would be much simpler and won't affect most of allocations. Bette= r 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. How about my reasoning? Thanks.