From patchwork Mon Apr 3 16:57:08 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tang Yizhou X-Patchwork-Id: 13198489 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 ECC13C76188 for ; Mon, 3 Apr 2023 16:57:18 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 647D26B0071; Mon, 3 Apr 2023 12:57:18 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 5D1526B0074; Mon, 3 Apr 2023 12:57:18 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 44A3D6B0075; Mon, 3 Apr 2023 12:57:18 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id 322BE6B0071 for ; Mon, 3 Apr 2023 12:57:18 -0400 (EDT) Received: from smtpin29.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id 076AC140C7C for ; Mon, 3 Apr 2023 16:57:18 +0000 (UTC) X-FDA: 80640685356.29.BC9B612 Received: from mail-pl1-f182.google.com (mail-pl1-f182.google.com [209.85.214.182]) by imf23.hostedemail.com (Postfix) with ESMTP id 465E0140021 for ; Mon, 3 Apr 2023 16:57:16 +0000 (UTC) Authentication-Results: imf23.hostedemail.com; dkim=pass header.d=shopee.com header.s=shopee.com header.b=XmQVOz2X; spf=pass (imf23.hostedemail.com: domain of yizhou.tang@shopee.com designates 209.85.214.182 as permitted sender) smtp.mailfrom=yizhou.tang@shopee.com; dmarc=pass (policy=reject) header.from=shopee.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1680541036; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:references:dkim-signature; bh=9I4ZecVy3fyI5IuMltEzbGksbXr8pR/9Hr3PJxym5iU=; b=JB9wK9LwV0RrGPrno07Q9UQtaW+FSMqHsH5x1HGammGfZlnUUp8JT8eZL3U/kqq4RERXSE TqIcm/YVfTIpLMBEOVAv9zUXryv2LIGNJ2OZFgQHqfN/hW+PZqbeBOuvyrtEjo13wViNGx kixokABals0N1fJRwg/LorvHCVCxU0I= ARC-Authentication-Results: i=1; imf23.hostedemail.com; dkim=pass header.d=shopee.com header.s=shopee.com header.b=XmQVOz2X; spf=pass (imf23.hostedemail.com: domain of yizhou.tang@shopee.com designates 209.85.214.182 as permitted sender) smtp.mailfrom=yizhou.tang@shopee.com; dmarc=pass (policy=reject) header.from=shopee.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1680541036; a=rsa-sha256; cv=none; b=riE0W11GhOTBUiIKwfaNV+DH5XM2KP24PvXMzmr1lf+SrSLCB2P3fC/chS2oeZEHdYBL6k YrVSYL12uDUP++ygQMmaFmroNhK82/pZJ10tGCy1gotzQtgMkr17PFYn456ekFoGi8rqTg VrBKjKc89zukM1460qbj2IAcuqRMkvM= Received: by mail-pl1-f182.google.com with SMTP id n14so12803686plc.8 for ; Mon, 03 Apr 2023 09:57:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=shopee.com; s=shopee.com; t=1680541035; x=1683133035; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=9I4ZecVy3fyI5IuMltEzbGksbXr8pR/9Hr3PJxym5iU=; b=XmQVOz2Xhpolkz4zevRlPrIc+tQ0fY2gz/ZTUCzNXxqkEfrwR/QL8KORuXXMp790lq zkZ5DE/AM7GAPeSWGKlX2oyAzBQKtGJ9Wz1g8y7ZyiDh0UYFzK3q8IO6/h5IpwIk1ReB r67F+8Jr/nf0B/fO2BVExZCemduSPCRuELQdyR9YIjKWsl87VLQ1au6KIhednBBTuldW zlPyheEvwYDVA+Jxm5MhCqpIcb9tdZI+rGb3PecNo3DKPA0Z6n6hfifeVV/HlK/0t11e XGfyPW6dnpokfbQU7nwRNqZzpQRLcUiRCflODlYZjHEoMEamKj71wlASBhfdI8jNosPS VCdQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1680541035; x=1683133035; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=9I4ZecVy3fyI5IuMltEzbGksbXr8pR/9Hr3PJxym5iU=; b=nAmIM6fhjkWYQK0HWezFeFNPowFcc5LmoLO9vO+mX7NQH0samegcfYtyBav+nY90bN yxqhUFbjb8SDSsvzNntkHreflkZpZFH/3EnQeb+3x5mbdTO8sCLPOkv4XWrtBkTm0W8e eoOTVblM1Mvm0dEsulenJDxO5ONkoDYXX+M0P0KzwnVUrxJYDzWqw9JIKEQFvwWzdoeq BUfrYc7ul/Bnacu8pkqp96+7AIrof1Gp5LDlTXpsf4Mg7UTzTLRJ7iFlav8Vb4HGZG8+ 3VqRgJecER3hZltvQqyzvnRdy46j/LBnvl1G+3xNVz7fnZVJ2SKcTYbuqZGKVksvuMZj bdUg== X-Gm-Message-State: AAQBX9dXJBje+nPp8nOU4Mm9jJ0q/4vlUrtUjSfW12AWV3J4+tgO5W2r WhsbD2A6amc88clYPHb0C1Q8DA== X-Google-Smtp-Source: AKy350ae5OzaFUvcdIZgoTF5QLkExG4f5r/Td4iepGkhfYBxHkjAeoNxR++h1WDCi8Fo3fZbyBdIjw== X-Received: by 2002:a17:902:f985:b0:1a1:d24f:a5f6 with SMTP id ky5-20020a170902f98500b001a1d24fa5f6mr34306766plb.46.1680541035066; Mon, 03 Apr 2023 09:57:15 -0700 (PDT) Received: from ubuntu-yizhou.default.svc.cluster.local ([101.127.248.173]) by smtp.gmail.com with ESMTPSA id h10-20020a170902f7ca00b001994a0f3380sm6828494plw.265.2023.04.03.09.57.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 03 Apr 2023 09:57:14 -0700 (PDT) From: yizhou.tang@shopee.com To: neilb@suse.com, tj@kernel.org, wufengguang@huawei.com Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, tangyeechou@gmail.com, chunguang.xu@shopee.com, yue.zhao@shopee.com, Tang Yizhou Subject: [PATCH] mm: Fix memcg writeback for rt tasks Date: Tue, 4 Apr 2023 00:57:08 +0800 Message-Id: <20230403165708.352841-1-yizhou.tang@shopee.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 X-Rspamd-Queue-Id: 465E0140021 X-Stat-Signature: ykdoa1b89npixjiwjybtb3yctc9p43om X-Rspam-User: X-Rspamd-Server: rspam08 X-HE-Tag: 1680541036-367125 X-HE-Meta: U2FsdGVkX18x/5D2tUO+TarNlKzvk7B/qFXMrIEAhXaW/YGK1DYvF/acMwWKs8hMMzf3FVM+u+NkkvGZXqnP+V47EEJJc6C4PQIDeVLCb9qbDjXCYrYa0htJ/jSevNc0/o/Hjdd+TdR9a3NP4tgdJiog94u5p5+4lBxcWIYYcSCCOAZ9KHKSSh58QcOqpupglb4FBt5bhXeuoK8q3FWwI/h6IFLJ241dhS94L4hhw6gR9aKngBklVqnNwoKUSby0t2yXBms7eDYUorB70uxDQqny4WQWkL7veU+SpPC7dmUuviqg1wmeCTeGe2K5sCb+BgMNhQ2cPbd5Qs8gUlza9JWhqjSkEYW1Xt4NBxjZvrOuai8zEZykggh9Jcx3wVKQnb0PwzxzuUvECuOJFaTHQ4tvR9zRv1IxPC6tiPsSBR3ymUGhaaeVmu5lPaZYg1WE3xLONqaFGl09FcVB4TAvthXLFASRXwgC6UQfwh1qPDCehiW546UmBuaZsRcvD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0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: From: Tang Yizhou Neil said he didn't know what was wanted for realtime in the commit message of commit a37b0715ddf3 ("mm/writeback: replace PF_LESS_THROTTLE with PF_LOCAL_THROTTLE"). I think we need to distinguish between the global writeback and memcg writeback in domain_dirty_limits() for the rt tasks. Fixes: a53eaff8c119 ("MM: increase safety margin provided by PF_LESS_THROTTLE") CC: NeilBrown CC: Tejun Heo CC: Fengguang Wu Signed-off-by: Tang Yizhou --- mm/page-writeback.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mm/page-writeback.c b/mm/page-writeback.c index 516b1aa247e8..7d92de73360e 100644 --- a/mm/page-writeback.c +++ b/mm/page-writeback.c @@ -419,8 +419,8 @@ static void domain_dirty_limits(struct dirty_throttle_control *dtc) bg_thresh = thresh / 2; tsk = current; if (rt_task(tsk)) { - bg_thresh += bg_thresh / 4 + global_wb_domain.dirty_limit / 32; - thresh += thresh / 4 + global_wb_domain.dirty_limit / 32; + bg_thresh += bg_thresh / 4 + dtc_dom(dtc)->dirty_limit / 32; + thresh += thresh / 4 + dtc_dom(dtc)->dirty_limit / 32; } dtc->thresh = thresh; dtc->bg_thresh = bg_thresh;