Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp613439pxf; Thu, 8 Apr 2021 09:27:15 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwMQwqnFipd0xzh1bGAAvGV6ZNnHg5O1gv2ZLWVM0HKv1wBAO4vJzDc7BLvLvg7yAk503E5 X-Received: by 2002:a05:6a00:1e:b029:241:72c2:695e with SMTP id h30-20020a056a00001eb029024172c2695emr8113190pfk.17.1617899235472; Thu, 08 Apr 2021 09:27:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1617899235; cv=none; d=google.com; s=arc-20160816; b=gCQOLGXio43rHiK69AG6riCpRMYK8auOjezCoR8dDrpgvVBhjkhjye+YLqMYxtQ+B/ kBnQaJq6gNpK/GiAB3hDza9gQrdgKveCA6wbAQ7EJQgJpoyba/BTFthyIXe+uQPJetS7 BYG2SdlrNMsZPVMaeu8K6xA5RCtnovSq1NKmIQcxR2Y5D0J3r5g+XyGZoSghA9fwuA29 i3aLW0zmXjCHFBLf0Wjn0jCEnNVBPDCfUVsIVhw/75Vqg2rSQVIeJjPtO23QGq0aEkqk BxT0RCldKD5ff12Fj0H39kynqmrEqNUxsNaSvHCH0EDlkOKbHfU/p2CIXRHLrhGToflA 8W1w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=OhP7GymXFSKtZlfnt0/yi6SF4MHiLfNobLLfZttkPNg=; b=ETAdOqRTQnYk5H4BwpJ5NTD5JbJ9BWiUJbNmOqrBked0RB2fHpkvQ1FLreHxrib5ut TiPkZ2c7WjKG5VEJHZiMg4uckAmdwnCCOYglULdZFL6VrtLwYH/sc4e0OPyr2mF7WGG+ R8Um8cnS55GuGAtI+5QYvzPMB3Mt9ojjjIjz4YuC14TqVJV2m86s51N3wECn+8prifZe 6BQZewvQCnZTZEVj9K5Tqcb+JPhKlkooUv8HmoPk1iak+4+aAeBicoqevjJ32F+4fi59 G/QpGO83BDyxoqSxJzo6xfNhKNJ9ED/F1duZZ1Zz2LDhIeOPY+9kGM/ynGnnRr17Ks8j 7jxg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=pNP3+nw0; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id k12si32829138pgs.462.2021.04.08.09.27.01; Thu, 08 Apr 2021 09:27: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; dkim=pass header.i=@google.com header.s=20161025 header.b=pNP3+nw0; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232356AbhDHQZO (ORCPT + 99 others); Thu, 8 Apr 2021 12:25:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49538 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232345AbhDHQZK (ORCPT ); Thu, 8 Apr 2021 12:25:10 -0400 Received: from mail-lf1-x134.google.com (mail-lf1-x134.google.com [IPv6:2a00:1450:4864:20::134]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 23BCDC061761 for ; Thu, 8 Apr 2021 09:24:58 -0700 (PDT) Received: by mail-lf1-x134.google.com with SMTP id g8so4978136lfv.12 for ; Thu, 08 Apr 2021 09:24:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=OhP7GymXFSKtZlfnt0/yi6SF4MHiLfNobLLfZttkPNg=; b=pNP3+nw0beqqrktG7Qie1dyDV4VmIMTq0UwmxM/5Sy5GbRLRfwgh+YWj0pIv0+jMw9 9WCqIIzsivso6CM/3M1eM/MyxDQaZtoRm3iZj8GpXZGLq6USw578MYrsIwfXNlFIulIW +n/4hMXYlP5tphCL1r7xo3d4yFIedzoQ0a+4oFS8tmLcnsC0sIEBa1ZY7vW5CXPGFLzJ XiT4U5W3LAeXk/7KXilNkSqdc/gXcnKNG6GNEyGR/lbZJB1QcGjyTjAad7FcLS7ZJMWB 4RMNOqfrgOqnCQ/w7oNhEe3XoBeJqmHp2rYfhs3bNxY8mlIWL6O4nxCOB7PN7PhBZgbM XaBg== 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; bh=OhP7GymXFSKtZlfnt0/yi6SF4MHiLfNobLLfZttkPNg=; b=UADFNqD7NFm65luO5TI+SYLVLLGBSGGgndf5snTEQjlcyFesqPNoVmYLozRDFUsj3A 1o3C6WtFMlfPZYuOvlzcg76o1EabuoV4Kpt2lfaq+r4s2BFEMtANPQLUCSFWJkVFBTfx 0yNpPsH122cfPXL2QhHBwosHwWhPevyq3d93P9O18nJcKNLfvIdsNYiNRvaJDBmHaqFO ssnqLj5JDtjqsz24tLqA6VH6/Mdg3ouKBbv2U4pSPxZ8LvnOOCNBPzZCEYo2ytpF12lP 9gd1ety9eCyOO0+/vZjgFzbrUjD8omrfLOgkYK+UO/YRobCtk12HTknQw5Jvb0hEpYP5 +XnQ== X-Gm-Message-State: AOAM5304EWZCMrG9uqnGSplV1ginmoGvlLV83lflnTqscz7s20DYg52y ZFJk1QOmEj2fElxGqdOwm0czGu1gEpbAphP+GJ6zxQ== X-Received: by 2002:a05:6512:34c7:: with SMTP id w7mr6855594lfr.83.1617899096362; Thu, 08 Apr 2021 09:24:56 -0700 (PDT) MIME-Version: 1.0 References: <20210408143155.2679744-1-hannes@cmpxchg.org> In-Reply-To: <20210408143155.2679744-1-hannes@cmpxchg.org> From: Shakeel Butt Date: Thu, 8 Apr 2021 09:24:45 -0700 Message-ID: Subject: Re: [PATCH] mm: page_counter: mitigate consequences of a page_counter underflow To: Johannes Weiner Cc: Andrew Morton , Michal Hocko , Hugh Dickins , Roman Gushchin , Linux MM , Cgroups , LKML , Kernel Team Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Apr 8, 2021 at 7:31 AM Johannes Weiner wrote: > > When the unsigned page_counter underflows, even just by a few pages, a > cgroup will not be able to run anything afterwards and trigger the OOM > killer in a loop. > > Underflows shouldn't happen, but when they do in practice, we may just > be off by a small amount that doesn't interfere with the normal > operation - consequences don't need to be that dire. > > Reset the page_counter to 0 upon underflow. We'll issue a warning that > the accounting will be off and then try to keep limping along. > > [ We used to do this with the original res_counter, where it was a > more straight-forward correction inside the spinlock section. I > didn't carry it forward into the lockless page counters for > simplicity, but it turns out this is quite useful in practice. ] > > Signed-off-by: Johannes Weiner Reviewed-by: Shakeel Butt