Received: by 10.213.65.68 with SMTP id h4csp3256444imn; Mon, 9 Apr 2018 17:36:35 -0700 (PDT) X-Google-Smtp-Source: AIpwx496Nzdy7dNQRz0dIYQae4GIEyJyeHC0OmxkaVYe4hQNB43ZfUOT/GKcG9iF08fDZvDtPUl2 X-Received: by 10.101.89.5 with SMTP id f5mr26420508pgu.428.1523320595268; Mon, 09 Apr 2018 17:36:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523320595; cv=none; d=google.com; s=arc-20160816; b=MjvJ+1uTfd8TS16demCrYdL7eNum1ba3iycHuXpng/DGkixnafSEcjxGGLJ5RnwHd8 DcTJ9M/d7maZbReW8t+1HlSLLmSNUfbTa/H6Jj3WuAhaClFX6/ik41kUlL/ZKafaRYpF 09oCRxPvWz/uneMT3+6m3G2TLPHk9kTHcP8Io6f/KDK75limCnfABfe4AIJHO49lFv44 mJ3w708oUq62CqGAKeeo24YB4hptEx5Ru+IAHSXSlzhGlATB9yjRjCmtudSE01RTRv/o c9fc1q6m+DlKeuiFnLNEuZDKLOIr6dteICOmDSKonQ2wWHLUxyv+DwwnR6/B45yioPsM AKDw== 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=ncqjOfOfJ8XKnZWw89s/Zc3ZPgHsiCuHLblWn7CTf0w=; b=Sk3KrWStzoblRidCeEUoCV0Y3NzMKGqOWVY/XZj9MwD4VmRK3VI/VoyNM+dfJ7jTbq ZqwO7ifUcXOEGgTFz3zVUHUeAwRUONV5z/+A3gIJyPG9nAWp7VCAsLM/oCj1Kdj5DTAG 3Y13Gltn+0zBeUAf17jQmv00Nq78irZzTvg5bZCHICcO3Z6zHm5AFfPQoRnPQxlV6Yg1 fuXJaebrct9Eqe+DjHmcnaFgChcUw+YfV7M2T/ioDwhhtLUEl1tp0sqYVfeorGntslfN EfhuMCK8jrFJV/S9eO6m+Dmbsh7taPXAvgrzDnH7edsPDu6xgjSnTAEIrjvgNghJj7SS 3CAw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=QM+jeHal; 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 k70si937324pgc.622.2018.04.09.17.35.58; Mon, 09 Apr 2018 17:36:35 -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=QM+jeHal; 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 S1751635AbeDJAc6 (ORCPT + 99 others); Mon, 9 Apr 2018 20:32:58 -0400 Received: from mail-wm0-f49.google.com ([74.125.82.49]:50848 "EHLO mail-wm0-f49.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751367AbeDJAc5 (ORCPT ); Mon, 9 Apr 2018 20:32:57 -0400 Received: by mail-wm0-f49.google.com with SMTP id t67so22683274wmt.0 for ; Mon, 09 Apr 2018 17:32:57 -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=ncqjOfOfJ8XKnZWw89s/Zc3ZPgHsiCuHLblWn7CTf0w=; b=QM+jeHalMTKqIPXjYklN5dCMRCLjWhg940pBg7RQa8MGYIHColN/Pl12dRni1TJR91 bSHKFYyKftVUJU4hLLPMcC55Q6e2TN7oxmmHoZXMsj9rSRZyqLTj28rOSAkdOkldSLhj 5+mceYtMhkR7o2v25rlFYWpW+tXevda/y0m1xIJmXiAemqMgCqLIi5besSBb7Do3opjl SYANF0UKDSfgmgGbdkcDAw3wfI/Nw0IrT1FFtz2Vob64vIIOE/slWLknTpF8b0jlpxM5 M2MNMSJL9dkzmjrGjeLVUxQiFYcxYl4tFxMrBu5bQcpiXL2CpTMpQKVRGrM3cvEZWKf3 ex3Q== 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=ncqjOfOfJ8XKnZWw89s/Zc3ZPgHsiCuHLblWn7CTf0w=; b=a8P6ejpI28JSuF6YcgcDySt3ZlXon1rx7K7fblrKofvxgRSeNeKtkyGCPXHDAeuCJA mbVTCdWrojgSKQxL4KwBW2h8XlGHTg46gm7EwANK6mT4EyLdHKb3S7HLKP8TLZerKNRo aksGXJcT11aopmH8nZT1LxKCcqZweWtDp5nyGF11vvlk/wFBpOlUbLjnNrhGQcmjc1r0 yDY+EAdYZSIRYdnFw9cYfxQKVBXwLkmP9UUtY/yT7gQfocMK0SpIuwPIdhoDnmHxNfM2 wZ2FOX0n6anBuyq/sjtt5ACqRzFtNX58D33AR6vC945Lhk9rTPGN94O6MasYxgPspSPl HrSQ== X-Gm-Message-State: ALQs6tCjfT56xYlprQqU/mlGhLNoz70LWL51YLbshXoJx+M1zTMy8w3t 1ijBtzA76BzEVsuUiCcL15+rGBLGPbq4K7Hz+6k= X-Received: by 10.80.145.111 with SMTP id f44mr59212eda.29.1523320376455; Mon, 09 Apr 2018 17:32:56 -0700 (PDT) MIME-Version: 1.0 Received: by 10.80.201.76 with HTTP; Mon, 9 Apr 2018 17:32:56 -0700 (PDT) In-Reply-To: <20180409094944.6399b211@gandalf.local.home> References: <1523153783-20579-1-git-send-email-zhaoyang.huang@spreadtrum.com> <20180407234812.2bf2b24b@gandalf.local.home> <20180408084717.62ee4f9e@gandalf.local.home> <20180409094944.6399b211@gandalf.local.home> From: Zhaoyang Huang Date: Tue, 10 Apr 2018 08:32:56 +0800 Message-ID: Subject: Re: [PATCH v1] ringbuffer: Don't choose the process with adj equal OOM_SCORE_ADJ_MIN To: Steven Rostedt Cc: 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 Mon, Apr 9, 2018 at 9:49 PM, Steven Rostedt wrote: > On Mon, 9 Apr 2018 08:56:01 +0800 > Zhaoyang Huang wrote: > >> >> >> >> if (oom_task_origin(task)) { >> >> points = ULONG_MAX; >> >> goto select; >> >> } >> >> >> >> points = oom_badness(task, NULL, oc->nodemask, oc->totalpages); >> >> if (!points || points < oc->chosen_points) >> >> goto next; >> > >> > And what's wrong with that? >> > >> > -- Steve >> I think the original thought of OOM is the flag 'OOM_SCORE_ADJ_MIN' is >> most likely to be set by process himself via accessing the proc file, >> if it does so, OOM can select it as the victim. except, it is >> reluctant to choose the critical process to be killed, so I suggest >> not to set such heavy flag as OOM_SCORE_ADJ_MIN on behalf of -1000 >> process. > > Really, I don't think tasks that are setting OOM_CORE_ADJ_MIN should be > allocating a lot of memory in the kernel (via ring buffer). It sounds > like a good way to wreck havoc on the system. > > It's basically saying, "I'm going to take up all memory, but don't kill > me, just kill some random user on the system". > > -- Steve Sure, but the memory status is dynamic, the process could also exceed the limit at the moment even it check the available memory before. We have to add protection for such kind of risk. It could also happen that the critical process be preempted by another huge memory allocating process, which may cause insufficient memory when it schedule back.