Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp333301imm; Sat, 14 Jul 2018 01:33:19 -0700 (PDT) X-Google-Smtp-Source: AAOMgpcpm2H9M93LvvNUgWtF59/3e0u+BkXNIRmZQ1Kz4Flj7pdNj/qMnxS66wBpeXo6+gq25HMj X-Received: by 2002:a62:2b4c:: with SMTP id r73-v6mr10290342pfr.134.1531557199140; Sat, 14 Jul 2018 01:33:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1531557199; cv=none; d=google.com; s=arc-20160816; b=r8wGYXEo+Lg0XkntL60gImxJ8/xXveyYZpoWrCooGcaGeKHIM4GAwjNtrR2e8WGrBu K1gg40r8IyMcGAL2I1N3+W9phVZ7XT9BIlk88OztWfdTgP17cvABBDzqA3m3MrBa1Ew9 JZlEVN44eGvkjw2oyqd3uPcTViB0vgcta9XHACrO7MjGDzcE0nXBxGhfSZ+ii7+PJgYp 24wm/pJjeC1nh15QfVwO3Xl/FkLM7e9mzUB/vWF7uYLEyo4MAE9a3zFbtRv45lM6AGzW vCE75XmRHz3ItbDPTbhdfjubpVjBWUWUjTOc9/53NwAKU1AFb2c5jMshA9GB9CTL71cO s8Wg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature:arc-authentication-results; bh=Akf5sLt8347RHVY+scAnPDa1ovmW923VlqnFnICc500=; b=Dh+r1ZR6d9yOegJi0ZAOPSCTSwFdTAGK2xnrMG+Gw8pwUWBkzY8Gmrxuc6RWrNdum7 0WZv2f5J0mjy157i0Y80dpGd4GIwzdg++bAvNHGNzbRsWpndkT75LlRj9P2YpC72X5BZ kcDpA0o4qlvzC7NkmrYX7NvkAsieQlYc1sC4oIlLNHgOsfsMne8O38E21l+wL5aqdV2I Nyg6Mmhk7UsZcBXNKGh7t2sPzOTjy2/ZNydIDI+dBWzGPxvb2XK13YKPEwqbnq43N4U6 78pgZwBHsvMhZwrx65HtR5RrD+nvg9h793FpEHo+cJUApbcY+eIuTmFDGol01t2XRe8C ewFA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=urtRXWaM; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v16-v6si25303188plo.186.2018.07.14.01.33.04; Sat, 14 Jul 2018 01:33:19 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=urtRXWaM; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726979AbeGNIut (ORCPT + 99 others); Sat, 14 Jul 2018 04:50:49 -0400 Received: from mail-pg1-f195.google.com ([209.85.215.195]:40783 "EHLO mail-pg1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726567AbeGNIus (ORCPT ); Sat, 14 Jul 2018 04:50:48 -0400 Received: by mail-pg1-f195.google.com with SMTP id x5-v6so5741915pgp.7; Sat, 14 Jul 2018 01:32:30 -0700 (PDT) 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-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=Akf5sLt8347RHVY+scAnPDa1ovmW923VlqnFnICc500=; b=WYdxOVmED2cre/0Fu8QQAnWDCbRxXyBn+NJLgBepYg6poTUJAVAs9fJl7PGUWfyuAA c4VSOwWF28d22fUtvpPLLXTPnivtI+ptFTVe7z9nIjANl6Ru/B/2lbZPQsEMefTEqZl6 epaWzvuNaI9VUDNCtQoEWRYzGPwgEIhrSGu9ZhpeKxB2rOhk5QWKQRpfvfVhqaQwUhBd h9mjJkZzHwDcc/aH7erMvhn/ydhs55+1LfCkUZngUSqkEF4vSGZJkU4Dnf5VB2xvgj0p BLS+kDm0yxumtYb2npUZAeEYXZbLaWlqEsMUt/PDjbJ1FxAHdWVDgo7cJ1UIHmjFZ0KZ jdzg== X-Gm-Message-State: AOUpUlFvwzzGRLA+CugN4gcpJH/xr7r2V9i2b52TzGoAAyBwEMuFFB8b nNXRfOX0poqLIx3QQplMpAU= 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 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 -- 1.8.3.1