Received: by 10.213.65.68 with SMTP id h4csp2318594imn; Thu, 5 Apr 2018 12:50:23 -0700 (PDT) X-Google-Smtp-Source: AIpwx4/6rXQgrBjuUqU8l+iLfbtTsw0SvvZepfG6YZ6Y+3snl0NsiBpzb0il0Dt85ZGSmbOvx3SO X-Received: by 10.99.42.65 with SMTP id q62mr11178605pgq.110.1522957823064; Thu, 05 Apr 2018 12:50:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1522957823; cv=none; d=google.com; s=arc-20160816; b=cn2ckqOqLNz9aQrrAG5HWlMt4JMvylHAVLwnD9Xwp8umHfdfr+HmF632zrJ3MxWKQG j8pkYLiPE1Rs7wkgqCdwuw4GNFC444UDU3WuL5UC3VwLbg1z/ZJdK5/a0CHNncOT3H8f 8Crp1sv3VdjsD56Z0SCa8SmZN+jC+cy6K9uGJrP3axskAp808vRsHs7F6bdIV3mnlFUF uvL3mtk6agr+kXZZyku1aeQgu2tOf7MrEf7JVanIjrBKIzLkf0JSIf00CPdfze5Na1OK CBTfhZe8Y0lHeXqU2wd0+t3I7jQOX4M6H0MHUcGrap3fmLkwQQGcScIwHVRoR1f3XFFc of/A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :references:in-reply-to:mime-version:dkim-signature :arc-authentication-results; bh=nBja+WvDV+55LkR/DUizpOOXb4IKzDC1bVIKqC3AY0A=; b=Qy9sRjNxLSQaPbzz/BtKFdoHYca78264WVWIp5rfOxvmXRN/E8kTHDjHVI53sCi01M iNDJazjZg9p6PfUMINQcSoXMkaluSGiSen0b+SkXai+iiJ0IPIUQ88Kd+reHolh0z0ql ipkZ46p2j+NmRVnJfmgdeZEjUlX5AX9ROt8XSQG6qjYbckQSN2u/8IKQMzXzDmgvJAvZ uekDtlL2MX/ozWkA+kytqS2n5fNkG6VwL33lwVQKN/Xi8FA4pd8mYcPOH5/VmOWjCqYo E7/IJyydkF9vWThWZMzAUFZMijqQHihiIe1DClnRL8zOo8TpS6SgvmJkuIUYs54D7G5J 5usw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=mU31Pi4+; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 71-v6si10160963plf.244.2018.04.05.12.50.08; Thu, 05 Apr 2018 12:50:23 -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=@google.com header.s=20161025 header.b=mU31Pi4+; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752869AbeDETrs (ORCPT + 99 others); Thu, 5 Apr 2018 15:47:48 -0400 Received: from mail-io0-f193.google.com ([209.85.223.193]:45349 "EHLO mail-io0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752203AbeDETrr (ORCPT ); Thu, 5 Apr 2018 15:47:47 -0400 Received: by mail-io0-f193.google.com with SMTP id 141so31985610iou.12 for ; Thu, 05 Apr 2018 12:47:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=nBja+WvDV+55LkR/DUizpOOXb4IKzDC1bVIKqC3AY0A=; b=mU31Pi4+tXqP4g00CI0bHtsDWcRR/VLSRi1A0IafOTi9UJiziF+KrDM1yBlW06mZSr jgm8LmPZhO/b9R1BicL68SFkUbGvexPRpbORbmKq8e/9+3Sl9MQiltLeD33XUE1yGcvs 5OIQOkF320a2YgXInmGdJmNfXArERjON/75OTlcXYvqTJtOymTdNozQlYatmG+glS2Kg U6VCYvKr7xT1NyGg9cjlLYusf3m++Pk7cu1UY1HkbKoI5GhM9LpsrdvUnWf/1npJvqnQ tlO75t172KIJ7FpGagovXBF2f2PLlxQYEVZwIZeIyrTCSNsfz2+3c52i9GV/X0l2sChO JY7Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=nBja+WvDV+55LkR/DUizpOOXb4IKzDC1bVIKqC3AY0A=; b=qossmcB/8Y+5/MslMtHpQzkOp+AoJnCs2SQLoYCBW1rMuipoZO5GNd+UQJKMDLUiiT oQMFMKhbWBqeMk9X+UzeZbyUoz8n13gr6X6H+6G01jOhwV0gYXYAF66X+BEQefVf4oDY vGWun63wzoXjK0qclMVbVQ/dOS7pQMfRotmSfnaEo58RRnWzTI8PStor9wAyPUvVBkG/ mp8ZlKllQuU3d68YJb7/bPtcXNsl9qOGzMeDQCIX3OW1s8X0VMbKo2AI4N6qV2ZwYmh6 5YEVMKgBQ0Ej8QJVdhCjXmJWq9TlieWsMSqugxWPmj6/cdlswWFM4AUovKLuKBCMONtm iElw== X-Gm-Message-State: ALQs6tC337OppaYOWGRY6ZdGImLv6jcRJ99jcvUwIIprRvoQwzHKZVF1 mTM+b4yNmYY7ey/JDDEmPNb4XFpZuZQM78Uu0TjKaduR8mM= X-Received: by 10.107.33.197 with SMTP id h188mr20639683ioh.235.1522957666279; Thu, 05 Apr 2018 12:47:46 -0700 (PDT) MIME-Version: 1.0 Received: by 10.107.11.158 with HTTP; Thu, 5 Apr 2018 12:47:45 -0700 (PDT) In-Reply-To: <20180405145159.GM6312@dhcp22.suse.cz> References: <20180404115310.6c69e7b9@gandalf.local.home> <20180404120002.6561a5bc@gandalf.local.home> <20180404121326.6eca4fa3@gandalf.local.home> <20180405145159.GM6312@dhcp22.suse.cz> From: Joel Fernandes Date: Thu, 5 Apr 2018 12:47:45 -0700 Message-ID: Subject: Re: [PATCH] ring-buffer: Add set/clear_current_oom_origin() during allocations To: Michal Hocko Cc: Steven Rostedt , LKML , Zhaoyang Huang , Ingo Molnar , kernel-patch-test@lists.linaro.org, Andrew Morton , "open list:MEMORY MANAGEMENT" , Vlastimil Babka Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Apr 5, 2018 at 7:51 AM, Michal Hocko wrote: > On Wed 04-04-18 16:59:18, Joel Fernandes wrote: >> Hi Steve, >> >> On Wed, Apr 4, 2018 at 9:18 AM, Joel Fernandes wrote: >> > On Wed, Apr 4, 2018 at 9:13 AM, Steven Rostedt wrote: >> > [..] >> >>> >> >>> Also, I agree with the new patch and its nice idea to do that. >> >> >> >> Thanks, want to give it a test too? >> >> With the latest tree and the below diff, I can still OOM-kill a victim >> process doing a large buffer_size_kb write: >> >> I pulled your ftrace/core and added this: >> + /* >> i = si_mem_available(); >> if (i < nr_pages) >> return -ENOMEM; >> + */ >> >> Here's a run in Qemu with 4-cores 1GB total memory: >> >> bash-4.3# ./m -m 1M & >> [1] 1056 >> bash-4.3# >> bash-4.3# >> bash-4.3# >> bash-4.3# echo 10000000 > /d/tracing/buffer_size_kb >> [ 33.213988] Out of memory: Kill process 1042 (bash) score >> 1712050900 or sacrifice child >> [ 33.215349] Killed process 1056 (m) total-vm:9220kB, >> anon-rss:7564kB, file-rss:4kB, shmem-rss:640kB > > OK, so the reason your memory hog is triggered is that your echo is > built-in and we properly select bask as an oom_origin but then another > clever heuristic jumps in and tries to reduce the damage by sacrificing > a child process. And your memory hog runs as a child from the same bash > session. Oh, ok. Makes sense. > > I cannot say I would love this heuristic. In fact I would really love to > dig it deep under the ground. But this is a harder sell than it might > seem. Anyway is your testing scenario really representative enough to No honestly I don't care much for this heuristic but was just helping test it. The scenario is not something I care about, but it seems like if I hit it then others users will too. Maybe Zhaoyang can try his use case again with ftrace/core and si_mem_available commented? IOW I was just helping test the new patch with the si_mem_available check commented out. > care? Does the buffer_size_kb updater runs in the same process as any > large memory process? In this Qemu run its just the cat process. At work I use trace-cmd or atrace neither of which I believe have large memory footprints (AFAIK) Thanks, - Joel