From patchwork Thu Feb 10 08:14:33 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shakeel Butt X-Patchwork-Id: 12741534 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 C6F72C433F5 for ; Thu, 10 Feb 2022 08:14:55 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 396676B0074; Thu, 10 Feb 2022 03:14:55 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 345A36B007B; Thu, 10 Feb 2022 03:14:55 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 2340B6B007D; Thu, 10 Feb 2022 03:14:55 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0106.hostedemail.com [216.40.44.106]) by kanga.kvack.org (Postfix) with ESMTP id 169806B0074 for ; Thu, 10 Feb 2022 03:14:55 -0500 (EST) Received: from smtpin06.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id B6EE8181CA772 for ; Thu, 10 Feb 2022 08:14:54 +0000 (UTC) X-FDA: 79126159308.06.5EB23F9 Received: from mail-oo1-f73.google.com (mail-oo1-f73.google.com [209.85.161.73]) by imf20.hostedemail.com (Postfix) with ESMTP id 59FE51C0008 for ; Thu, 10 Feb 2022 08:14:54 +0000 (UTC) Received: by mail-oo1-f73.google.com with SMTP id h13-20020a4aa74d000000b002e99030d358so3190649oom.6 for ; Thu, 10 Feb 2022 00:14:54 -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=T9FcBDMwvgeHBlJy4y16uXfaabYSCGyJ3a5EN/2FH/k=; b=MxdsYuSId5HtvKIg92vKZD2AqHFrlV0PE/vRdDgoIOtAxeRQ9ojCRGSaEaK45fB/bh We8jMJdFWXIW3lmpW/ZDfeZqIzKdt/QwufKjFYFwGOjP5J1vxnhO4F61EVjj6I5nQCH9 fDEgALX0BPefVUNsfL9sWq0H2oZnkV64CrnT5tb6XTyHRbhSH20LE7MeL9YrcLKE+Upn ca0C2CBxPkElew+dpCqGOsBsQheR9rbsOFacWIyuWmkdp6LjxepL0z7kc5y4slTtujd4 Lyx2Ub3/D9/fZ76P15/g2wgvb8rYb5WxFCWJrzgsjaJGP5phBtg3xbKKR3MOb87xNC86 TOKw== 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=T9FcBDMwvgeHBlJy4y16uXfaabYSCGyJ3a5EN/2FH/k=; b=xDs0je77YOJU4TMpZfRTohWgOgStY25n11WTbSRhAOXV0D/TdtY3RJ8aQ9KBUFEhGm CT/AUWqYzC9PjpFKm/tRiauFZ+O21s/YAF9dwcE8n6xhBrdEi8dHCFP7VQnU3GkyhX+S h64WIw0OHKWr58/b9spBKD+IqaDZNQS3mR6cqOpztHEUx2mBzwJgyxcJqSK7QjsJV3RC vMgk7MabdHNOeWEUI8rmGgiRzCCUnaNNI19mujuDdfGhSsH7L1r5U4Sy1EIlQZRyeu06 837TSPKzANMG7hLUfOtNrG95UYXp/NMZ0PqniYz3tn+9OwvBjfvXHXl8hFxWaRxDLOON njXQ== X-Gm-Message-State: AOAM530G5q2eNMTgSEne0FZopuw6APYPTI5WgCSCJdwmVa4Dw8fYiN7o 4wiU22Ou8qYJx65/mTVHa5ZkfWe4t/xD6w== X-Google-Smtp-Source: ABdhPJwpmJs5KvIzTk+4UqumkYVhgfmnjA3Xqt4XkjaPcdUfPtlskWzbyZqOPhpvf84nMJpU67NzE5RGU1VfFw== X-Received: from shakeelb.svl.corp.google.com ([2620:15c:2cd:202:6801:6774:cb90:c600]) (user=shakeelb job=sendgmr) by 2002:a05:6808:1688:: with SMTP id bb8mr599419oib.163.1644480893417; Thu, 10 Feb 2022 00:14:53 -0800 (PST) Date: Thu, 10 Feb 2022 00:14:33 -0800 Message-Id: <20220210081437.1884008-1-shakeelb@google.com> Mime-Version: 1.0 X-Mailer: git-send-email 2.35.1.265.g69c8d7142f-goog Subject: [PATCH 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-Rspam-User: Authentication-Results: imf20.hostedemail.com; dkim=pass header.d=google.com header.s=20210112 header.b=MxdsYuSI; dmarc=pass (policy=reject) header.from=google.com; spf=pass (imf20.hostedemail.com: domain of 3fckEYggKCDoodWgaahXckkcha.Ykihejqt-iigrWYg.knc@flex--shakeelb.bounces.google.com designates 209.85.161.73 as permitted sender) smtp.mailfrom=3fckEYggKCDoodWgaahXckkcha.Ykihejqt-iigrWYg.knc@flex--shakeelb.bounces.google.com X-Rspamd-Server: rspam01 X-Rspamd-Queue-Id: 59FE51C0008 X-Stat-Signature: a7wgt9yajb9b8btq87roxgmxkhg7ta6i X-HE-Tag: 1644480894-395641 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000019, 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 bug 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 and making it more robust. 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 include/linux/page_counter.h | 10 + mm/memcontrol.c | 175 ++++++++++-------- mm/page_counter.c | 59 ++++-- tools/testing/selftests/cgroup/cgroup_util.c | 15 +- tools/testing/selftests/cgroup/cgroup_util.h | 1 + .../selftests/cgroup/test_memcontrol.c | 78 ++++++++ 6 files changed, 240 insertions(+), 98 deletions(-)