Received: by 2002:ac0:a581:0:0:0:0:0 with SMTP id m1-v6csp1154627imm; Wed, 20 Jun 2018 12:34:32 -0700 (PDT) X-Google-Smtp-Source: ADUXVKJVLr9Oh5iHY9D/MbvEEXUh7wiuTV0h0aqtxHea1KsOyAIWRmowkJalBT3y1ya0x4F0PW4Z X-Received: by 2002:a17:902:7b95:: with SMTP id w21-v6mr25352267pll.150.1529523272262; Wed, 20 Jun 2018 12:34:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1529523272; cv=none; d=google.com; s=arc-20160816; b=r6WQxKhaEq5Lksh0wfPSZa2wU+vZCzkt5UlzkQVmcg0Jf4I5uPoC5oE5WDMe0pVUpo NK7KDK0OwNgvnVfrXL+C5bVkYzKB3WakLaKuy5A1+hBiKVAU61YLMcxuQL9MZ7DRHRR+ DCC3P5wU9LVBX82VoSH00Hyp9Re+ytDlhydZt6GMSRjHzquKl3KMWmwmumuMtqKheiav U24sbUCleRFZOcM9v1oP9pwa3p0YpaQsu7iNGdwn1saA6cYtZ1hTTWKYItGMk9vuqai1 2ycjQbDzZ5w4DBctwW7bifETM/9tz7jZDQX+HeqWZwl+1SsyPE9FgT7RY9tDXCv3IdOd RDQA== 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:dkim-signature:arc-authentication-results; bh=5JdjDvMk5yQ1H5dvBF4jlKKN5fQUxG40qqisxcfxRT0=; b=smFamr52tna/3uADjrTCF16/KpyN9MkbWaBXPjGoB3CwLqcmE37hqRIR1wsFvKK77L TEzBLo+p8S4pLrNj5Go6b+RExpD6lkQt+Zc+nhTymB7xPY2Y9ylz+e+S6wXbv2iBP4F4 p1h7xqG4FpGVVG1EaDiC75L8BN7yEzv70Mt7dRyhjLqQn75QtEQ8E6+XyQ7I7aTHb4oj kIAK4/iJt9/gBQjL1+SFp1Ot/zG2jpJj3SgiRaJ0a0+vrMKabmc7Sui8dqtsgYaZ1it+ 8uMVJF4oVvPEXSl5JG0wgU6lav14EdbeF6+D7Ef03BxZDtvMzP2gyR+S4X0vf8Q6SI4W vM+Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@cmpxchg.org header.s=x header.b=NQ5WRFGa; 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=cmpxchg.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t130-v6si2558087pgc.250.2018.06.20.12.34.17; Wed, 20 Jun 2018 12:34:32 -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=fail header.i=@cmpxchg.org header.s=x header.b=NQ5WRFGa; 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=cmpxchg.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754702AbeFTTdb (ORCPT + 99 others); Wed, 20 Jun 2018 15:33:31 -0400 Received: from gum.cmpxchg.org ([85.214.110.215]:48630 "EHLO gum.cmpxchg.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754653AbeFTTda (ORCPT ); Wed, 20 Jun 2018 15:33:30 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=cmpxchg.org ; s=x; h=In-Reply-To:Content-Type:MIME-Version:References:Message-ID:Subject: Cc:To:From:Date:Sender:Reply-To:Content-Transfer-Encoding:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=5JdjDvMk5yQ1H5dvBF4jlKKN5fQUxG40qqisxcfxRT0=; b=NQ5WRFGaHOb/vqtt++qEUzLD6P bRZx0l/eB2ZAKEAoh5baSeSPJ76CVAT+Rb91vIoKAv/aTTWzxdvJ6VIN+LE8rwG0SLX+jBySYA3+D omiDWlWGkzX3qIul/40fCa7/mWhNHrqCvhyBgXS4UGWyI+oyQ5TS14oQBOAMeDFMznhU=; Date: Wed, 20 Jun 2018 15:35:49 -0400 From: Johannes Weiner To: Michal Hocko Cc: linux-mm@kvack.org, Greg Thelen , Shakeel Butt , Andrew Morton , LKML Subject: Re: [RFC PATCH] memcg, oom: move out_of_memory back to the charge path Message-ID: <20180620193549.GA4734@cmpxchg.org> References: <20180620103736.13880-1-mhocko@kernel.org> <20180620151812.GA2441@cmpxchg.org> <20180620153148.GO13685@dhcp22.suse.cz> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180620153148.GO13685@dhcp22.suse.cz> 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 Wed, Jun 20, 2018 at 05:31:48PM +0200, Michal Hocko wrote: > This? > if (order > PAGE_ALLOC_COSTLY_ORDER) > return OOM_SKIPPED; > > /* > * We are in the middle of the charge context here, so we > * don't want to block when potentially sitting on a callstack > * that holds all kinds of filesystem and mm locks. > * > * cgroup1 allows disabling the OOM killer and waiting for outside > * handling until the charge can succeed; remember the context and put > * the task to sleep at the end of the page fault when all locks are > * released. > * > * On the other hand, in-kernel OOM killer allows for an async victim > * memory reclaim (oom_reaper) and that means that we are not solely > * relying on the oom victim to make a forward progress and we can > * invoke the oom killer here. > * > * Please note that mem_cgroup_oom_synchronize might fail to find a > * victim and then we have rely on mem_cgroup_oom_synchronize otherwise > * we would fall back to the global oom killer in pagefault_out_of_memory > */ > if (memcg->oom_kill_disable) { > if (!current->memcg_may_oom) > return OOM_SKIPPED; > css_get(&memcg->css); > current->memcg_in_oom = memcg; > current->memcg_oom_gfp_mask = mask; > current->memcg_oom_order = order; > > return OOM_ASYNC; > } > > if (mem_cgroup_out_of_memory(memcg, mask, order)) > return OOM_SUCCESS; > > WARN(!current->memcg_may_oom, > "Memory cgroup charge failed because of no reclaimable memory! " > "This looks like a misconfiguration or a kernel bug."); > return OOM_FAILED; Yep, this looks good IMO.