Received: by 10.213.65.68 with SMTP id h4csp3589154imn; Tue, 10 Apr 2018 01:08:31 -0700 (PDT) X-Google-Smtp-Source: AIpwx4/l11hPdY2cYXuMPlKeMLvB7jbyyH5h6VvGW9P07OJbVUYsouNyCZKUYYTTGuatFEg3wHo5 X-Received: by 10.99.125.87 with SMTP id m23mr26783666pgn.297.1523347711133; Tue, 10 Apr 2018 01:08:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523347711; cv=none; d=google.com; s=arc-20160816; b=ZSIRukx7IiRcz5FzEhqWPMJwYjK/fq7Y0NskQlCcGtbZ1E0T6qTyvRTE11DLMCbznX fjB/l4Ku3IawzERZJRLfD2WU2R6mCm2UBXcs9b7zMj95iB0jXkjsLfMBTePTvxq2Hl7J SRcGGtGZmv+Al50Su0BzNr9njmbrdVZLpIX68avpQiOCiJzZB+9HWz92v1WJQmgCWQdS fhN6PX3fdyH+GbUV6cWi7e6g6cW4LWOCnweFXIxyLLSC3vfk8MPCHlfWyDeFBV6uEwk9 Zt051q7blIIXrUfJg/VxY2EwWuJoGRaYluarbdtk1trTfP/qu2VePdXVpmpC8vnmMUOr XwsQ== 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=Of4LRIXT21LFvo5eQ3xn2rSG25g/FzgF9x7+r5x27CI=; b=EV9czedzl4ZkwRhse9UAL/2PIQjaO5A9E3yJRYtd7BJ+oJGFXJ3RcblquKlJog7l2o FkD2TbpC0tqzj5isCygRlChiYUtRVb2WvziXy0ym2YzDyKBpbNYw2ccxlw6ZDy3gTCZM FWxtbP4yhKReagZ9559s9DBX39VzkKFZC5eBNsgE0IjJCQ5NsJ7FzpTKOqWG3vnjmj6R +uN3W+EZXqiEXzbQBA0WwmLgmwH0iIqn2MxoGcf8hPIgHHhGhoo3KRgur0hcXAYzlvA0 r98xisQDBzgiyssMxo8H5cr4DNVeG1MRYT+4PQlyfGGzARRwkkdxaOaH/RPniNahX/Om EzUQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=rpUDYTJe; 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 h6si1409432pgp.831.2018.04.10.01.07.53; Tue, 10 Apr 2018 01:08:31 -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=rpUDYTJe; 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 S1752196AbeDJIEo (ORCPT + 99 others); Tue, 10 Apr 2018 04:04:44 -0400 Received: from mail-wm0-f66.google.com ([74.125.82.66]:36129 "EHLO mail-wm0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751892AbeDJIEm (ORCPT ); Tue, 10 Apr 2018 04:04:42 -0400 Received: by mail-wm0-f66.google.com with SMTP id x82so21450040wmg.1 for ; Tue, 10 Apr 2018 01:04:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=Of4LRIXT21LFvo5eQ3xn2rSG25g/FzgF9x7+r5x27CI=; b=rpUDYTJeas5YjUxew40F3YrbHD+X4y8hq5sEh1o+V2FI/uJ/gZpUx8ZQv0q0Mae6d+ +QlZ+AUZBpSrqg0954VYg0c63p/BC+EpGUK82dL3oQLBDQhsQQib96Ww21smZLyryZR1 UumSj/XVE8qqVQkUD7nn3RkMvIkrJKZ8I3EYVO6NCE/5TkE3HcH6yM5hot2tz166P/i4 duuIbEhJXlKwtQvOkPbw0PCzhTXS7DtqPT0ugK2Tt5Yf5u6sw9RCwJPidpuIsD3RNGeC uQ+DsOMSgU0Z4zmG0l50MbSBmJxaUNv8leWZ5fbm9gIRjHQcc8ZR6ethxkz+W5qT3GY/ hiEg== 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=Of4LRIXT21LFvo5eQ3xn2rSG25g/FzgF9x7+r5x27CI=; b=BcE1XwoSfUPRcY9LGRzCmQ4suKqaR68qX8fPHsFtoWdy42QXL1Vjv8Ws9oGaWripwK wyk+52U/sFMQLMut4RY6SBUm495kRjxtd0PCl5TUp5At/qSsKksE0/safo9EIRRUoziX QtTwam1ZnAyBjIbK3P/AN9bYHx+OEVWQDojk6+El2qTkHibSW8hwuGlh6n19Dr0SReDb 7zHcOAwwZy7SiL3JuncwO58YAQGkhbVg8+fG6JGWuyFWBi+M9QLU9hOSZHAUrbtN5kRe qs3Xs2gI4sBGevgLS7A5lvIU7oOc8DSDWVLzF6HXUUglyXzbA9MAVzzjfWhIHoUtOMai Wc1A== X-Gm-Message-State: ALQs6tAJqCKJPYICUZDLXaXlX+fyyqx/rPsToPQxRQQd09iaXKok0+JH uMAwTlZQGhxBSEjaZiLj2sRacdyFTRnagNP5sJI= X-Received: by 10.80.129.167 with SMTP id 36mr1695254ede.13.1523347481200; Tue, 10 Apr 2018 01:04:41 -0700 (PDT) MIME-Version: 1.0 Received: by 10.80.201.76 with HTTP; Tue, 10 Apr 2018 01:04:40 -0700 (PDT) In-Reply-To: <20180410074921.GU21835@dhcp22.suse.cz> References: <20180408084717.62ee4f9e@gandalf.local.home> <20180409094944.6399b211@gandalf.local.home> <20180409231230.1ab99e85@vmware.local.home> <20180410061447.GQ21835@dhcp22.suse.cz> <20180410074921.GU21835@dhcp22.suse.cz> From: Zhaoyang Huang Date: Tue, 10 Apr 2018 16:04:40 +0800 Message-ID: Subject: Re: [PATCH v1] ringbuffer: Don't choose the process with adj equal OOM_SCORE_ADJ_MIN To: Michal Hocko Cc: Steven Rostedt , Ingo Molnar , LKML 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 Tue, Apr 10, 2018 at 3:49 PM, Michal Hocko wrote: > On Tue 10-04-18 14:39:35, Zhaoyang Huang wrote: >> On Tue, Apr 10, 2018 at 2:14 PM, Michal Hocko wrote: >> > On Tue 10-04-18 11:41:44, Zhaoyang Huang wrote: >> >> On Tue, Apr 10, 2018 at 11:12 AM, Steven Rostedt wrote: >> >> > On Tue, 10 Apr 2018 10:32:36 +0800 >> >> > Zhaoyang Huang wrote: >> >> > >> >> >> For bellowing scenario, process A have no intension to exhaust the >> >> >> memory, but will be likely to be selected by OOM for we set >> >> >> OOM_CORE_ADJ_MIN for it. >> >> >> process A(-1000) process B >> >> >> >> >> >> i = si_mem_available(); >> >> >> if (i < nr_pages) >> >> >> return -ENOMEM; >> >> >> schedule >> >> >> ---------------> >> >> >> allocate huge memory >> >> >> <------------- >> >> >> if (user_thread) >> >> >> set_current_oom_origin(); >> >> >> >> >> >> for (i = 0; i < nr_pages; i++) { >> >> >> bpage = kzalloc_node >> >> > >> >> > Is this really an issue though? >> >> > >> >> > Seriously, do you think you will ever hit this? >> >> > >> >> > How often do you increase the size of the ftrace ring buffer? For this >> >> > to be an issue, the system has to trigger an OOM at the exact moment >> >> > you decide to increase the size of the ring buffer. That would be an >> >> > impressive attack, with little to gain. >> >> > >> >> > Ask the memory management people. If they think this could be a >> >> > problem, then I'll be happy to take your patch. >> >> > >> >> > -- Steve >> >> add Michael for review. >> >> Hi Michael, >> >> I would like suggest Steve NOT to set OOM_CORE_ADJ_MIN for the process >> >> with adj = -1000 when setting the user space process as potential >> >> victim of OOM. >> > >> > OOM_SCORE_ADJ_MIN means "hide the process from the OOM killer completely". >> > So what exactly do you want to achieve here? Because from the above it >> > sounds like opposite things. /me confused... >> > >> Steve's patch intend to have the process be OOM's victim when it >> over-allocating pages for ring buffer. I amend a patch over to protect >> process with OOM_SCORE_ADJ_MIN from doing so. Because it will make >> such process to be selected by current OOM's way of >> selecting.(consider OOM_FLAG_ORIGIN first before the adj) > > I just wouldn't really care unless there is an existing and reasonable > usecase for an application which updates the ring buffer size _and_ it > is OOM disabled at the same time. > -- > Michal Hocko > SUSE Labs There is indeed such kind of test case on my android system, which is known as CTS and Monkey etc. Furthermore, I think we should make the patch to be as safest as possible. Why do we leave a potential risk here? There is no side effect for my patch.