Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp2052474imm; Mon, 16 Jul 2018 01:00:06 -0700 (PDT) X-Google-Smtp-Source: AAOMgpd2tmKSFYsHUrhBKTds4ql3XohZ/vk0GaK8F558/yXDAHHiEw+/A+ENQZVnMJQRwOlOanvT X-Received: by 2002:a17:902:143:: with SMTP id 61-v6mr15539833plb.171.1531728006042; Mon, 16 Jul 2018 01:00:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1531728006; cv=none; d=google.com; s=arc-20160816; b=opfiRTPsZI7Feiia4ClDq2s19W1g5u4+nrDYHOm8ticH39qjNwcg9H1xaFqlTfhBQ8 uURp83BLz9UZebMNqmqC6x7vLv7rysvpSeB6g84IrWSdswViq+e63P8hv3iz+POfnynk 0bgcxWGVEFmt6AIVuVjAMbyZHWoG8XeoEGMlHN+I/pGgA6a+f7TtelyLFw/gFLkAnVH1 T3bWip067KLwWX9x6L/wDSxj4B1NGDUUnJ5twA69HIDpxlIAHgs0Q51ir15xQhY5Tfni 4Mbw4XjH6ikYwtNFDCzD0kSZrKflo8TEl1ckr/H2MMYKhvBpBgJmigaYADuKe1GaM+zm r82A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:arc-authentication-results; bh=DBGbEgOa8XIWb4144fkzWRqTswGoHPk9Dg/6Bv17l0E=; b=WdU2VqyC+IZUyB0QQOohx8UH9vE3CVxPBw5RMFdijhIOPNlw0aCmpx+Rp/Qt0E/ddx QZg2i7yM2LcUr54satViSXK8NHCBfAjl4orgbvB3DjiBr0Rj9mpvAu5q33CaatZunoDm dZB2XQ0tr974SN31IG8NuUti9STi3qncXC2GkwgjKBfPPBShWqrnLhKwYydVudj1AhiF UXPHvok79oCvWSB6BbSef6pnHN7Gwqz0ltkjzem/TbTbvjQR45eJMGf/3cxVVD4OPrOz kR40dig5L1eWC7RbFhEumaBZIk+3k2ne+xPplGmLubfUXnz+oG114jaJyRCHpNUPAmT/ hqzw== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 33-v6si30274684plg.260.2018.07.16.00.59.50; Mon, 16 Jul 2018 01:00:06 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727775AbeGPIYp (ORCPT + 99 others); Mon, 16 Jul 2018 04:24:45 -0400 Received: from mx2.suse.de ([195.135.220.15]:45896 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726190AbeGPIYp (ORCPT ); Mon, 16 Jul 2018 04:24:45 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id 98E96ADBC; Mon, 16 Jul 2018 07:58:36 +0000 (UTC) Date: Mon, 16 Jul 2018 09:58:36 +0200 From: Michal Hocko To: Yafang Shao Cc: hannes@cmpxchg.org, vdavydov.dev@gmail.com, cgroups@vger.kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] mm: avoid bothering interrupted task when charge memcg in softirq Message-ID: <20180716075836.GC17280@dhcp22.suse.cz> References: <1531557122-12540-1-git-send-email-laoar.shao@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1531557122-12540-1-git-send-email-laoar.shao@gmail.com> User-Agent: Mutt/1.10.0 (2018-05-17) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat 14-07-18 16:32:02, Yafang Shao wrote: > 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. I agree with Shakeel that this changelog asks for more information about "why it matters". Small inconsistencies should be tolerable because the state we rely on is so rarely set that it shouldn't make a visible difference in practice. > 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; > + If anything would it make more sense to use in_interrupt() to be more bullet proof for future? > /* > * Unlike in global OOM situations, memcg is not in a physical > * memory shortage. Allow dying and OOM-killed tasks to > -- > 1.8.3.1 -- Michal Hocko SUSE Labs