From patchwork Sat Jul 14 08:32:02 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yafang Shao X-Patchwork-Id: 10524635 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id CAF1D602B3 for ; Sat, 14 Jul 2018 08:32:34 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id AB7D6292B5 for ; Sat, 14 Jul 2018 08:32:34 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8923C292C4; Sat, 14 Jul 2018 08:32:34 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, MAILING_LIST_MULTI, RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1AC28292B5 for ; Sat, 14 Jul 2018 08:32:34 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 9BC2E6B0007; Sat, 14 Jul 2018 04:32:32 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 96B8D6B0008; Sat, 14 Jul 2018 04:32:32 -0400 (EDT) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 85B446B000A; Sat, 14 Jul 2018 04:32:32 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-pf0-f199.google.com (mail-pf0-f199.google.com [209.85.192.199]) by kanga.kvack.org (Postfix) with ESMTP id 4237F6B0007 for ; Sat, 14 Jul 2018 04:32:32 -0400 (EDT) Received: by mail-pf0-f199.google.com with SMTP id v25-v6so13932272pfm.11 for ; Sat, 14 Jul 2018 01:32:32 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:dkim-signature:from:to:cc:subject:date :message-id; bh=Akf5sLt8347RHVY+scAnPDa1ovmW923VlqnFnICc500=; b=ooUSAnTEKUJcSpAinoFHqb7ydzFB8vr8MiLv5IpBQUxyJuoinVss87s3ctsD/RyaTu yAVCADC1v5VaK5tLYw1Q0e7PpTBr1k3qDVu0uQjGxvUs5bWDYs9AncftmqCRO8wT0s9P IgpisICEIdrHpaKs+PDOeB0STtcegCuLJC1k7po9l/HfmWGcLaT8UflkpYLFVTCh6auH tcYJ1B5up0Pp0rC9BUe/uisBzwEUa39U0FnPrz30Qmsj/WJ7umlJwDcuD/RKReBBKeEN nllXis52ET+KV9setvW/zWz23X9sDC35Kf6y35hzONc8IALCnL2Q2NuZgRpo3Y0h6B7C x8XA== X-Gm-Message-State: AOUpUlFoKG16jwtTjjtH3LgCjpUj4tOK8CWoxrCoba7BoTvbULQLWfhd nCJm71xycEmEP4UHLq70t2hTKhxr99d3ba5+1pb0ILm303zOnobbSLqBgfr1rMkNlWrNWTdqn2p tFZYkLf1B/i7WYqN8739x1yi9xD4iqGOyk69r3aBBW2YEZqZVI9Ud1VFQrM+K7vmvKIEhETA5wF HikFWrW/zq+iBx4ivc5zGZcgLtEMrfeduzouy3WBeDngKUt6O35sqhB3uW3tMNMAXMP0SceEW14 ravoGaX06NARHh+qwQ7P73kv0pQt607ef9P8NPmPdrLDxJ5EoCbOOUDhUfDGfBWt9qtWmdUqsVs ytsymGlf+K+AEdgf4Dr0QuaByuYzvqxZ+ijYrlBqZo8n/YcFbjEkqFq8YEtgM9JPw5pghQTUBEe D X-Received: by 2002:a65:6143:: with SMTP id o3-v6mr9124202pgv.52.1531557151938; Sat, 14 Jul 2018 01:32:31 -0700 (PDT) X-Received: by 2002:a65:6143:: with SMTP id o3-v6mr9124164pgv.52.1531557151057; Sat, 14 Jul 2018 01:32:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1531557151; cv=none; d=google.com; s=arc-20160816; b=GccefgAqQVax5BArNy71xSts6UuMaUaFNljqJIePEOADsL75hsgVEValwwsmcQEALt gkQpbgRD5UxRhrjmufmSyNeX6ITTPQAEIGexv6tEAD24daqnEBmolqD+e2lwvQDfYamq LTfJKp6/bZ1bzHdycsF3v7lY5Hwi2PV/LhSEgVAHL7N4Fc6LPHSsBLB09ZuOfmZIvXNJ xuNERDk3uohFsMcKDHohdFbcBvpDEIj6FW0UAhx31p3CHCYQ+R2a9mB750yqqHM6EifX cfsw4C62IY8TG4efB8P8I3ADKJEsPR6ayr1bjxMveWxlTwerUryymizOcNCyLbRxclaB uUhQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=message-id:date:subject:cc:to:from:dkim-signature :arc-authentication-results; bh=Akf5sLt8347RHVY+scAnPDa1ovmW923VlqnFnICc500=; b=rH2wbRHyXfuUasV+79btS/XnOcEHV1poRCEuKE70nL3qidUBwcByphV1hNiR1QRODe THR+T3sRaecFpzXpCe+46JzgjUxcvuvAHv5lY3pXfmfpv6H6OV0hrpDcN5zxGVOIvcDe iKaWs+gw3EV/6fiLn4JdHT+Yi4a/eMTGnyDL6lkrlcf7b2PVM74ClVdD45yWpvOyeb4T bENNr0kjNRgu8mNJWEeksc8xmY2wuGMdj6iWfKsYZgPnP+wjTIBofL6IpKPUG90RteGV qZizCA0bY3uNkhZFDubLBwwzDZeWtRGPoM8wcohPgIDjnRblh2QzSGClk2+lHVLsxzpZ 3mow== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=urtRXWaM; spf=pass (google.com: domain of laoar.shao@gmail.com designates 209.85.220.65 as permitted sender) smtp.mailfrom=laoar.shao@gmail.com; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from mail-sor-f65.google.com (mail-sor-f65.google.com. [209.85.220.65]) by mx.google.com with SMTPS id x2-v6sor6483125pge.88.2018.07.14.01.32.30 for (Google Transport Security); Sat, 14 Jul 2018 01:32:31 -0700 (PDT) Received-SPF: pass (google.com: domain of laoar.shao@gmail.com designates 209.85.220.65 as permitted sender) client-ip=209.85.220.65; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=urtRXWaM; spf=pass (google.com: domain of laoar.shao@gmail.com designates 209.85.220.65 as permitted sender) smtp.mailfrom=laoar.shao@gmail.com; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=Akf5sLt8347RHVY+scAnPDa1ovmW923VlqnFnICc500=; b=urtRXWaM4QG2OkH5hzq0uiTLDIL43VY6FuA6MHz191bAZLEF8HbzrtRkY0Gas3f9ck w/jWZ+GaX/B51oJO5hHpZLv4Pj0+kUv6yEVKaSOLy3HH20P3TMuHpr0Mm+/o7CYhWiGT CKPoxvD/wyDqZVOcWTRMk8DPwux9wuP62FY/L0ERhebYDM/RuQqNVVBleUFBdYjrb7tv ip/xzq2VEBHcjHjSq3kwYT7XXBRKGMdvtgOXyDk7oTyeciEvMvfWk7L4Vx4eBO+3OuAl zzmRM8vYTNQEYtyDVGnJo5Rne+5Lgz2bR+V+T+b3Xter3mZ69VkP9n8/kx99+gWnAqrk q/Iw== X-Google-Smtp-Source: AAOMgpdAyim9LB1p4hOeqe25oh965zFusovkUP8fS/LiwLWWVpWvog8Zo7sgE0OnNspA7+UOJ9DY8g== X-Received: by 2002:a63:8548:: with SMTP id u69-v6mr8838683pgd.346.1531557150620; Sat, 14 Jul 2018 01:32:30 -0700 (PDT) Received: from bogon.didichuxing.com ([168.63.150.120]) by smtp.gmail.com with ESMTPSA id w16-v6sm83219857pfi.101.2018.07.14.01.32.27 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 14 Jul 2018 01:32:29 -0700 (PDT) From: Yafang Shao To: hannes@cmpxchg.org, mhocko@kernel.org, vdavydov.dev@gmail.com Cc: cgroups@vger.kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, Yafang Shao Subject: [PATCH] mm: avoid bothering interrupted task when charge memcg in softirq Date: Sat, 14 Jul 2018 16:32:02 +0800 Message-Id: <1531557122-12540-1-git-send-email-laoar.shao@gmail.com> X-Mailer: git-send-email 1.8.3.1 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: X-Virus-Scanned: ClamAV using ClamSMTP try_charge maybe executed in packet receive path, which is in interrupt context. In this situation, the 'current' is the interrupted task, which may has no relation to the rx softirq, So it is nonsense to use 'current'. Avoid bothering the interrupted if page_counter_try_charge failes. Signed-off-by: Yafang Shao --- mm/memcontrol.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/mm/memcontrol.c b/mm/memcontrol.c index 68ef266..13f95db 100644 --- a/mm/memcontrol.c +++ b/mm/memcontrol.c @@ -2123,6 +2123,9 @@ static int try_charge(struct mem_cgroup *memcg, gfp_t gfp_mask, goto retry; } + if (in_softirq()) + goto nomem; + /* * Unlike in global OOM situations, memcg is not in a physical * memory shortage. Allow dying and OOM-killed tasks to