Received: by 10.192.165.148 with SMTP id m20csp5258815imm; Wed, 9 May 2018 01:59:27 -0700 (PDT) X-Google-Smtp-Source: AB8JxZoK3CmV6Ip/2pZo9zs7YvVK+eW/tbgOQ+ihkahFL+Wfneqdxmho82x9ai+Q8StG0xhPccw/ X-Received: by 2002:a17:902:1c7:: with SMTP id b65-v6mr44659017plb.298.1525856367822; Wed, 09 May 2018 01:59:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1525856367; cv=none; d=google.com; s=arc-20160816; b=QzZOt2B5tipocQfQg2dL/KOnpv8qu59a5KmQug4r/ZZ/6nMO/y7IVelneMWjbe/gIp 6LgL5UhOCWgrv8ABq/EkifDtn2NXQZnlCtTqupFHGtj+Ph7O8vekllrmiM030+c3yXYD ikXxa3ViQ+2AhuBikFH4p2g9NTY8m0VGVRmZWy8XryTRfcD4HQLOlhhLGlR+0AEfGW3k I1xmcUoDWnNNCQF9AtQgvFnpLxdFYBvZxJtJ6k1A2eOXrd2Ye2vd93+epl1Ayi42CVZC W7cx/430nNp5kKqFMfjH4cTo/0CJ+IJ4L0xTYNaU75aHeW07YpO9+YXLXK4yLSBthA3f pegQ== 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=IKNSNPJxNnwgMiB3rJEUc8taTzjNoFX2Wpmz1yvZyHM=; b=jnLIH8o5JOlHqXP+yHeQFaNZxWfxTlu9ZmLjlnv0ab+mwortiKnMmP3lr6Q1/d3k+K vz5PRMOMYVwabwPFRVbAS5Uhzj/KtsDwNt++VBoz6FYJ1YzqudcFbfGrO1or/NPUDqFp XrwpoTaPYUEcNJ7MY4n2LN4FuIxULcH4VX9SA1Ben1uPOe8OUdyBIe0jkvCm1oAnHlrs TB/AGd0/wry/q954FUzDhX7/UB7EjHQsAjoO3pYNdcLzfjQjRkJyo8aGmyP6toKlKtnu WDhH7oEOsuGf0gIbpaG2txj9yPeIeQzstComtHLcJgGpbTFux8jlfQCIOT8RAfoBJe0S xoxw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=mAR85qRp; 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 r10-v6si16496780pgv.499.2018.05.09.01.59.13; Wed, 09 May 2018 01:59:27 -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=mAR85qRp; 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 S934492AbeEII6d (ORCPT + 99 others); Wed, 9 May 2018 04:58:33 -0400 Received: from mail-pg0-f52.google.com ([74.125.83.52]:46975 "EHLO mail-pg0-f52.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934007AbeEII62 (ORCPT ); Wed, 9 May 2018 04:58:28 -0400 Received: by mail-pg0-f52.google.com with SMTP id z4-v6so22363108pgu.13 for ; Wed, 09 May 2018 01:58:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=IKNSNPJxNnwgMiB3rJEUc8taTzjNoFX2Wpmz1yvZyHM=; b=mAR85qRpibDjQKbqSjopQraoOkJg6fEFtJp9V+6x1WLTyFEHMvNsshobezZp7t4Rkj qX1ZbQzh/bggCAkENp7ayAXVN6TNt20NFYkR+3TSg/q/UdUrDldiNOJdMnbdEdZXDBLI E4KH6PQZAFbYARGLsUFHlX91YMBiEZJowlfOB5uZFiyLfcuQDb2PyMzhphdfVmyUq2lM 8UADzy0vTWNcoxntM49VEOi2cvU3n6oOZdkchaHoX+vqQWz6Oi4mNfh1xu+P23hSXVIn +qvfLuXMEY4VV9fhi3hVcA6nuxA83YCeDd6ElaXei10qB3t55gqPmojV3iN0VW+uiMpq WDcw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=IKNSNPJxNnwgMiB3rJEUc8taTzjNoFX2Wpmz1yvZyHM=; b=rmleYGoHqzNVdhETqSwEqcfVDyEz8QNWOLJGFxqF8n4DhWjfzqE6CLQBJv4Prmn1uq Y1IK4k8fhkMvaM3iiZuzskCe+ds1+6L3nqnRSmF7quWvWU9nInoNxC1wwBHDXRQQImr5 DXH83CEH5AGMhWgP3iJzy1NtQmv3dQ/NSHUpOqm44/Mi0HJ2oWOM/eVCPkXW/7FciexV EOTKOqOEfBFI4gNSU/Jkc8b42Xh8rjZyHbbmTUeGza8oYHCXA5lOPe0Z3XnNn+7j1+La JUUBYh6iM0QVLvLq/UiMd/+FO1SM88hbetG82h35ow+LIs95IpPo9n0dPv3z65x7NNlV A+7Q== X-Gm-Message-State: ALQs6tB2K3t9uLSdzDvI0oeSTRHvtKGkNRdWMNpH8wd6KR9SLUVpUd6f VpsMlw+QBCyBKWiQa3WG18A= X-Received: by 2002:a65:5d51:: with SMTP id e17-v6mr35140719pgt.100.1525856307403; Wed, 09 May 2018 01:58:27 -0700 (PDT) Received: from localhost ([175.223.44.125]) by smtp.gmail.com with ESMTPSA id z13sm65839387pfk.156.2018.05.09.01.58.25 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 09 May 2018 01:58:26 -0700 (PDT) Date: Wed, 9 May 2018 17:58:22 +0900 From: Sergey Senozhatsky To: Tejun Heo , Petr Mladek , Andrew Morton , Steven Rostedt , Johannes Weiner , Michal Hocko , Vlastimil Babka Cc: Petr Mladek , Linus Torvalds , Sergey Senozhatsky , linux-mm@kvack.org, Cong Wang , Dave Hansen , Mel Gorman , Peter Zijlstra , Jan Kara , Mathieu Desnoyers , Tetsuo Handa , rostedt@home.goodmis.org, Byungchul Park , Sergey Senozhatsky , Pavel Machek , linux-kernel@vger.kernel.org Subject: Re: [PATCH v5 0/2] printk: Console owner and waiter logic cleanup Message-ID: <20180509085822.GB353@jagdpanzerIV> References: <20180110132418.7080-1-pmladek@suse.com> <20180110140547.GZ3668920@devbig577.frc2.facebook.com> <20180110162900.GA21753@linux.suse> <20180110170223.GF3668920@devbig577.frc2.facebook.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180110170223.GF3668920@devbig577.frc2.facebook.com> User-Agent: Mutt/1.9.5 (2018-04-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, Move printk and (some of) MM people to the recipients list. On (01/10/18 09:02), Tejun Heo wrote: [..] > The particular case that we've been seeing regularly in the fleet was > the following scenario. > > 1. Console is IPMI emulated serial console. Super slow. Also > netconsole is in use. > 2. System runs out of memory, OOM triggers. > 3. OOM handler is printing out OOM debug info. > 4. While trying to emit the messages for netconsole, the network stack > / driver tries to allocate memory and then fail, which in turn > triggers allocation failure or other warning messages. printk was > already flushing, so the messages are queued on the ring. > 5. OOM handler keeps flushing but 4 repeats and the queue is never > shrinking. Because OOM handler is trapped in printk flushing, it > never manages to free memory and no one else can enter OOM path > either, so the system is trapped in this state. Tejun, we have a theory [since there are no logs available] that what you are looking at is something as follows: console_unlock() { for (;;) { call_console_drivers() kmalloc()/etc /* netconsole, skb kmalloc(), for instance */ __alloc_pages_slowpath() warn_alloc() /* a bunch of printk() -> log_store() */ } } Now, warn_alloc() is rate limited to DEFAULT_RATELIMIT_INTERVAL / DEFAULT_RATELIMIT_BURST so net console driver can add 10 warn_alloc() reports every 5 seconds to the logbuf. You have a "super slow" IPMI console and net console. So for every logbuf entry we do: console_unlock() { for (;;) { call_console_drivers(msg) -> IPMI_write() call_console_drivers(msg) -> netconsole_write() -> skb kmalloc() -> warn_alloc() -> ratelimit } } IPMI_write() is very slow, as you have noted, so it consumes time printing messages, simultaneously warn_alloc() rate limit depends on time. *Probably*, slow IPMI_write() is unable to flush 10 warn_alloc() reports under 5 seconds, which gives net console a chance to add another 10 warn_alloc()-s, while the previous 10 warn_alloc()-s have not been flushed yet. It seems that DEFAULT_RATELIMIT_INTERVAL / DEFAULT_RATELIMIT_BURST warn_alloc() rate limit is too permissive for your setup. Can you confirm that the theory is actually correct? If it is correct, then can we simply tweak warn_alloc() rate limit? Say, make it x2 / x4 / etc. times less verbose? E.g. "up to 5 warn_alloc()-s every 10 seconds"? What do MM folks think? -ss