Received: by 2002:ac0:a582:0:0:0:0:0 with SMTP id m2-v6csp1796956imm; Sat, 13 Oct 2018 04:10:45 -0700 (PDT) X-Google-Smtp-Source: ACcGV638SjsirmXq5RMapXazgsig1COdVrRZK22ZcpBgPdhrJJgDk+qnQVPqpqx0awm6ZANjsS4l X-Received: by 2002:a62:5957:: with SMTP id n84-v6mr903087pfb.176.1539429045549; Sat, 13 Oct 2018 04:10:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1539429045; cv=none; d=google.com; s=arc-20160816; b=xlFT8P/QpG5yF1ePLcQp+LDmqUrj0Kq9w1SKzB0+fPtvsXAAuPokaMHPP+vxsMxclA j2hjID9GdAA9EhIjq/zWyFweNtrrHLD+oVVbJ29dKbk1i+SF5ycQn8DafNjDPaMZ5ti8 a4km5IheqDwCZj0LkT+1gYORiWSkit74SsryNQUYLKO+EWDkgcEhGUdrwNkL/YsBM60r WpqruJtAJVdsyvvgJ81exjcCvGAgUKGcOC+oKV48H5L/hoCUv1dasjrR8tW/NknRWQAc ydlJfq4Ypn4rssEpQHvXakObij0R57u5ZuFoaOMdqD5T+jV+Bq/DztEuwgPxgs8MHBol sWUQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:references:cc:to:from:subject; bh=0NR5rXssdW0+gY+LAOcuaQcTKgJpstyBTi6iummYgWQ=; b=ioG0fAiS/2wLKrm9zpkBYjmOvRxJr2uulEi3JvXsSwAaMD6Osogb10TH3TQUn3SkQf +UlsHhQ1wEUG2+Dvzam+1wB9AJZTAEFZybp+dEy7ayNEsZlyNL1y41FpFWlCKv5H5H27 x+09I2mTEjxCG6J/lfv6olxEt4GFhGDXDx1+Rf6vJs7Gb2DJ6xvioU8Y3XwDW6I3ZapK SijAtJ0A5VDf5KD5qklDWYEfFKTEocjeqBsqaEQnekRwCWqbJe+szZXR3rx/VpxIEguY SNpaXBHFkQjG0dUWBiJ5yk5KxsyBN98mKWULRw50qlGRIUojbvpiMgV6rKF9c3WH+Kap 3EZw== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y11-v6si3928897pfm.141.2018.10.13.04.10.17; Sat, 13 Oct 2018 04:10:45 -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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726263AbeJMSqW (ORCPT + 99 others); Sat, 13 Oct 2018 14:46:22 -0400 Received: from www262.sakura.ne.jp ([202.181.97.72]:59096 "EHLO www262.sakura.ne.jp" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726033AbeJMSqV (ORCPT ); Sat, 13 Oct 2018 14:46:21 -0400 Received: from fsav102.sakura.ne.jp (fsav102.sakura.ne.jp [27.133.134.229]) by www262.sakura.ne.jp (8.15.2/8.15.2) with ESMTP id w9DB9dat097725; Sat, 13 Oct 2018 20:09:39 +0900 (JST) (envelope-from penguin-kernel@i-love.sakura.ne.jp) Received: from www262.sakura.ne.jp (202.181.97.72) by fsav102.sakura.ne.jp (F-Secure/fsigk_smtp/530/fsav102.sakura.ne.jp); Sat, 13 Oct 2018 20:09:39 +0900 (JST) X-Virus-Status: clean(F-Secure/fsigk_smtp/530/fsav102.sakura.ne.jp) Received: from [192.168.1.8] (softbank060157066051.bbtec.net [60.157.66.51]) (authenticated bits=0) by www262.sakura.ne.jp (8.15.2/8.15.2) with ESMTPSA id w9DB9X0O097652 (version=TLSv1.2 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Sat, 13 Oct 2018 20:09:38 +0900 (JST) (envelope-from penguin-kernel@i-love.sakura.ne.jp) Subject: Re: [RFC PATCH] memcg, oom: throttle dump_header for memcg ooms without eligible tasks From: Tetsuo Handa To: Johannes Weiner , Michal Hocko Cc: linux-mm@kvack.org, syzkaller-bugs@googlegroups.com, guro@fb.com, kirill.shutemov@linux.intel.com, linux-kernel@vger.kernel.org, rientjes@google.com, yang.s@alibaba-inc.com, Andrew Morton , Sergey Senozhatsky , Petr Mladek , Sergey Senozhatsky , Steven Rostedt References: <000000000000dc48d40577d4a587@google.com> <20181010151135.25766-1-mhocko@kernel.org> <20181012112008.GA27955@cmpxchg.org> <20181012120858.GX5873@dhcp22.suse.cz> <9174f087-3f6f-f0ed-6009-509d4436a47a@i-love.sakura.ne.jp> <20181012124137.GA29330@cmpxchg.org> <0417c888-d74e-b6ae-a8f0-234cbde03d38@i-love.sakura.ne.jp> Message-ID: Date: Sat, 13 Oct 2018 20:09:30 +0900 User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: <0417c888-d74e-b6ae-a8f0-234cbde03d38@i-love.sakura.ne.jp> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2018/10/12 21:58, Tetsuo Handa wrote: > On 2018/10/12 21:41, Johannes Weiner wrote: >> On Fri, Oct 12, 2018 at 09:10:40PM +0900, Tetsuo Handa wrote: >>> On 2018/10/12 21:08, Michal Hocko wrote: >>>>> So not more than 10 dumps in each 5s interval. That looks reasonable >>>>> to me. By the time it starts dropping data you have more than enough >>>>> information to go on already. Not reasonable at all. >>>> >>>> Yeah. Unless we have a storm coming from many different cgroups in >>>> parallel. But even then we have the allocation context for each OOM so >>>> we are not losing everything. Should we ever tune this, it can be done >>>> later with some explicit examples. >>>> >>>>> Acked-by: Johannes Weiner >>>> >>>> Thanks! I will post the patch to Andrew early next week. >>>> One thread from one cgroup is sufficient. I don't think that Michal's patch is an appropriate mitigation. It still needlessly floods kernel log buffer and significantly defers recovery operation. Nacked-by: Tetsuo Handa ---------- Testcase ---------- #include #include #include #include #include int main(int argc, char *argv[]) { FILE *fp; const unsigned long size = 1048576 * 200; char *buf = malloc(size); mkdir("/sys/fs/cgroup/memory/test1", 0755); fp = fopen("/sys/fs/cgroup/memory/test1/memory.limit_in_bytes", "w"); fprintf(fp, "%lu\n", size / 2); fclose(fp); fp = fopen("/sys/fs/cgroup/memory/test1/tasks", "w"); fprintf(fp, "%u\n", getpid()); fclose(fp); fp = fopen("/proc/self/oom_score_adj", "w"); fprintf(fp, "-1000\n"); fclose(fp); fp = fopen("/dev/zero", "r"); fread(buf, 1, size, fp); fclose(fp); return 0; } ---------- Michal's patch ---------- 73133 lines (5.79MB) of kernel messages per one run [root@ccsecurity ~]# time ./a.out real 3m44.389s user 0m0.000s sys 3m42.334s [root@ccsecurity ~]# time ./a.out real 3m41.767s user 0m0.004s sys 3m39.779s ---------- My v2 patch ---------- 50 lines (3.40 KB) of kernel messages per one run [root@ccsecurity ~]# time ./a.out real 0m5.227s user 0m0.000s sys 0m4.950s [root@ccsecurity ~]# time ./a.out real 0m5.249s user 0m0.000s sys 0m4.956s