From patchwork Fri Feb 11 06:49:13 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shakeel Butt X-Patchwork-Id: 12742924 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id D3B13C433F5 for ; Fri, 11 Feb 2022 06:49:27 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 3AAAB6B0073; Fri, 11 Feb 2022 01:49:27 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 35AED6B0075; Fri, 11 Feb 2022 01:49:27 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 1FC446B0078; Fri, 11 Feb 2022 01:49:27 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0027.hostedemail.com [216.40.44.27]) by kanga.kvack.org (Postfix) with ESMTP id 0C26A6B0073 for ; Fri, 11 Feb 2022 01:49:27 -0500 (EST) Received: from smtpin19.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id AB7CF95B1E for ; Fri, 11 Feb 2022 06:49:26 +0000 (UTC) X-FDA: 79129572732.19.627F2D6 Received: from mail-yb1-f202.google.com (mail-yb1-f202.google.com [209.85.219.202]) by imf16.hostedemail.com (Postfix) with ESMTP id 45A82180006 for ; Fri, 11 Feb 2022 06:49:26 +0000 (UTC) Received: by mail-yb1-f202.google.com with SMTP id 3-20020a250103000000b0061d99b7d0b8so17037847ybb.13 for ; Thu, 10 Feb 2022 22:49:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=date:message-id:mime-version:subject:from:to:cc; bh=7cEUUMm8No+47SEC0UonhOqIuTdbXjwICtqwH1vHhoQ=; b=fb3bmiUsrp8W4YmAG3agpua6xnfwRewOZ8YA8GXSqnYAPC8zDIVx6AoedzrfSysYph zzvjaiNO751h5z4oCLk4zWH107SG09igxaI4HWBb1br4poFMySSL6hi1EE3b+DYhoSkr E8isZ/nwurJsTuixeh5zQ22wHMxuwcRqJYWTA+SlpVkjSTo1VKwRMe+ZUHsup7SwY5XP j0dXPMF/835VLYM3EhP1F/flECnKhOMqisNWuPeE9/Uo+X/0hqoGEnt+lp+mcMd8/d04 p1R9iZ10rYSwdyqK3vsqBTfPZ8kYkC+5e/3cs9ufj47kI+7yPQufY7yIHZMwKB5NfcpC ioxA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:message-id:mime-version:subject:from:to:cc; bh=7cEUUMm8No+47SEC0UonhOqIuTdbXjwICtqwH1vHhoQ=; b=FYuVkSauQwJ/T8RR4+O38hubKDZohZIp+8yx/u5F6xeOPZoZvMsW3trpvVyHYGJGDf YFVp8Ozsy/ZnBAyGtStilOVZwiyG2XNNthhZo1+lK+YRoVSkeXzJqa68TmgM9mdcgc21 NxlPLClDa8w75CvQsdW0dTKgeFFBvG9Ws1THd7lXwLOZDFLd5W5OltoFW4rMbRLGCZDc keGkCO4XnfNFDUukQ13RORGXbJbEKbbptwHOPBdMH6Ofsx7zHmpn9+hgFufhQrPZF16h 6k33XpRDCXMy/bfS1WAq/rInX9xIkFpEVLCryqcSgadqH8HKN0yUmOq4IXujP2MkTzf0 mRkg== X-Gm-Message-State: AOAM531xZtluOmqfJkprc/djTfHtSMqXs7GzcBv3l+ZgL7p1hNm16KuU PQGoFAij0uRV7x6LP09Stm7x9M57QWQzPA== X-Google-Smtp-Source: ABdhPJwjcJt1qNgxSN9vWV7QgR7LvR6l6f8Pvejc675UNvm/3bhAMhZsP+fwGZb5+wH9V5YwUfVByIzNtijgDg== X-Received: from shakeelb.svl.corp.google.com ([2620:15c:2cd:202:9a07:ef1a:2fee:57f1]) (user=shakeelb job=sendgmr) by 2002:a81:1ec2:: with SMTP id e185mr336741ywe.324.1644562165435; Thu, 10 Feb 2022 22:49:25 -0800 (PST) Date: Thu, 10 Feb 2022 22:49:13 -0800 Message-Id: <20220211064917.2028469-1-shakeelb@google.com> Mime-Version: 1.0 X-Mailer: git-send-email 2.35.1.265.g69c8d7142f-goog Subject: [PATCH v2 0/4] memcg: robust enforcement of memory.high From: Shakeel Butt To: Johannes Weiner , Michal Hocko , Roman Gushchin Cc: Chris Down , Andrew Morton , cgroups@vger.kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, Shakeel Butt X-Rspamd-Server: rspam05 X-Rspamd-Queue-Id: 45A82180006 X-Stat-Signature: gywjzt489jcgk4h1iqb8sckihsht4ofc Authentication-Results: imf16.hostedemail.com; dkim=pass header.d=google.com header.s=20210112 header.b=fb3bmiUs; spf=pass (imf16.hostedemail.com: domain of 39QYGYggKCDIgVOYSSZPUccUZS.QcaZWbil-aaYjOQY.cfU@flex--shakeelb.bounces.google.com designates 209.85.219.202 as permitted sender) smtp.mailfrom=39QYGYggKCDIgVOYSSZPUccUZS.QcaZWbil-aaYjOQY.cfU@flex--shakeelb.bounces.google.com; dmarc=pass (policy=reject) header.from=google.com X-Rspam-User: X-HE-Tag: 1644562166-213774 X-Bogosity: Ham, tests=bogofilter, spamicity=0.001276, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: Due to the semantics of memory.high enforcement i.e. throttle the workload without oom-kill, we are trying to use it for right sizing the workloads in our production environment. However we observed the mechanism fails for some specific applications which does big chunck of allocations in a single syscall. The reason behind this failure is due to the limitation of the memory.high enforcement's current implementation. This patch series solves this issue by enforcing the memory.high synchronously if the current process has accumulated a large amount of high overcharge. Changes since v1: - Based on Roman's comment simply the sync enforcement and only target the extreme cases. Shakeel Butt (4): memcg: refactor mem_cgroup_oom memcg: unify force charging conditions selftests: memcg: test high limit for single entry allocation memcg: synchronously enforce memory.high for large overcharges mm/memcontrol.c | 66 +++++++--------- tools/testing/selftests/cgroup/cgroup_util.c | 15 +++- tools/testing/selftests/cgroup/cgroup_util.h | 1 + .../selftests/cgroup/test_memcontrol.c | 78 +++++++++++++++++++ 4 files changed, 120 insertions(+), 40 deletions(-)