From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.4 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,USER_AGENT_SANE_2 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9AE38C432C3 for ; Tue, 19 Nov 2019 15:58:33 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 4CCED22362 for ; Tue, 19 Nov 2019 15:58:33 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lca.pw header.i=@lca.pw header.b="q0/4rbRZ" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 4CCED22362 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=lca.pw Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id C9C876B0005; Tue, 19 Nov 2019 10:58:32 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id C4E086B0006; Tue, 19 Nov 2019 10:58:32 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id B3E226B0007; Tue, 19 Nov 2019 10:58:32 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0203.hostedemail.com [216.40.44.203]) by kanga.kvack.org (Postfix) with ESMTP id 9E2586B0005 for ; Tue, 19 Nov 2019 10:58:32 -0500 (EST) Received: from smtpin12.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with SMTP id 2AFF4181AC9B6 for ; Tue, 19 Nov 2019 15:58:32 +0000 (UTC) X-FDA: 76173484464.12.cable34_10363d5e0cc4b X-HE-Tag: cable34_10363d5e0cc4b X-Filterd-Recvd-Size: 6048 Received: from mail-qv1-f65.google.com (mail-qv1-f65.google.com [209.85.219.65]) by imf09.hostedemail.com (Postfix) with ESMTP for ; Tue, 19 Nov 2019 15:58:31 +0000 (UTC) Received: by mail-qv1-f65.google.com with SMTP id g12so8303257qvy.12 for ; Tue, 19 Nov 2019 07:58:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=lca.pw; s=google; h=message-id:subject:from:to:cc:date:in-reply-to:references :mime-version:content-transfer-encoding; bh=1z5z/i+3LcTUqYQxh88HeAp06C7NWtljha+VhmnIoik=; b=q0/4rbRZzWyL2IQLLIRg9XxI7yVsxFhM0SqLGtUDlDWUnV4Cx9fQki4nQnyOu4FNdz MgQNxzZhvmeNQ4vxKWKJtCQDbUTdNBQ/xV4ZzzAuYYpG7kI4kzg88KFEjKB1OOop5/MM dmXWHVVk0f4IFEfTzJxC6wcIumqRKUt94xq2t5M1QrFtdREOzai+F5k09z+z/k7Jqu2c BbEiwmnIPaHiEI7Zt/2/+6F59OuFSlOgnOLvgDI/i2RqODvIB0JSGBdy0iHPtmZxlA3s 3kg9/g+NZCqZF2g4heUVMqHBqHVmvfVaEeVCQXYnhyuzSasBKFdARpAUYdnI1+guGW/u oDwQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:message-id:subject:from:to:cc:date:in-reply-to :references:mime-version:content-transfer-encoding; bh=1z5z/i+3LcTUqYQxh88HeAp06C7NWtljha+VhmnIoik=; b=Auvuj4SmruPgMq9lUwEGh6L/XlEIZYrKmo33/LdHP6/+1q9oTqj9TT7AgEvZ1AfV0F v94Z1Um5lzEnRXFc8TuPhsxsXqEj3e7x2cQ3jrnMLyX6G/EerauLBop+4JVGw6WHi5Hh S0p5HhpiiixkI5/OuLm/O+db7r9YR6B9pT9dnnkpPSlS5Xmwrswz7clxdgFdZw2TUWvS FMd8gmPt8jPACt6GYT1rVOTO8Akf+f8SuAkg3Oxe5gIJB1EQPL1Y7wlrSqoRLke5Ip0r I8V8I2nUAl6W5kYIwBplCFCruSCnAyj9Oe3RJ/TuRt8uNPi2JieTS/Lk9900wmmCYLPw f3gA== X-Gm-Message-State: APjAAAWlcnlbxiEBn8J7fTfWMeeqrC83UdpJGACu+EvSk/GR9emXXhLz IbDSs9uLumiIbNkhPnO4CfaYmw== X-Google-Smtp-Source: APXvYqzQs4PHJxtGOjF5LF5GaxORkXbZEPYtAW8Ec/ZJQGupHFmldpVxF1PjfxTctBnYnLVlTTelSQ== X-Received: by 2002:ad4:4dce:: with SMTP id cw14mr20727040qvb.185.1574179109802; Tue, 19 Nov 2019 07:58:29 -0800 (PST) Received: from dhcp-41-57.bos.redhat.com (nat-pool-bos-t.redhat.com. [66.187.233.206]) by smtp.gmail.com with ESMTPSA id i10sm11536583qtj.19.2019.11.19.07.58.28 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 19 Nov 2019 07:58:29 -0800 (PST) Message-ID: <1574179107.9585.1.camel@lca.pw> Subject: Re: [PATCH] net/skbuff: silence warnings under memory pressure From: Qian Cai To: Petr Mladek , Sergey Senozhatsky Cc: Steven Rostedt , Sergey Senozhatsky , Michal Hocko , Eric Dumazet , davem@davemloft.net, netdev@vger.kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org Date: Tue, 19 Nov 2019 10:58:27 -0500 In-Reply-To: <20191119094134.6hzbjc7l5ite6bpg@pathway.suse.cz> References: <20190904065455.GE3838@dhcp22.suse.cz> <20190904071911.GB11968@jagdpanzerIV> <20190904074312.GA25744@jagdpanzerIV> <1567599263.5576.72.camel@lca.pw> <20190904144850.GA8296@tigerII.localdomain> <1567629737.5576.87.camel@lca.pw> <20190905113208.GA521@jagdpanzerIV> <1573751570.5937.122.camel@lca.pw> <20191118152738.az364dczadskgimc@pathway.suse.cz> <20191119004119.GC208047@google.com> <20191119094134.6hzbjc7l5ite6bpg@pathway.suse.cz> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.22.6 (3.22.6-10.el7) Mime-Version: 1.0 Content-Transfer-Encoding: 7bit X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Tue, 2019-11-19 at 10:41 +0100, Petr Mladek wrote: > On Tue 2019-11-19 09:41:19, Sergey Senozhatsky wrote: > > On (19/11/18 16:27), Petr Mladek wrote: > > > > > @@ -2027,8 +2027,11 @@ asmlinkage int vprintk_emit(int facility, int level, > > > > > pending_output = (curr_log_seq != log_next_seq); > > > > > logbuf_unlock_irqrestore(flags); > > > > > > > > > > + if (!pending_output) > > > > > + return printed_len; > > > > > + > > > > > /* If called from the scheduler, we can not call up(). */ > > > > > - if (!in_sched && pending_output) { > > > > > + if (!in_sched) { > > > > > /* > > > > > * Disable preemption to avoid being preempted while holding > > > > > * console_sem which would prevent anyone from printing to > > > > > @@ -2043,10 +2046,11 @@ asmlinkage int vprintk_emit(int facility, int level, > > > > > if (console_trylock_spinning()) > > > > > console_unlock(); > > > > > preempt_enable(); > > > > > - } > > > > > > > > > > - if (pending_output) > > > > > + wake_up_interruptible(&log_wait); > > > > > > I do not like this. As a result, normal printk() will always deadlock > > > in the scheduler code, including WARN() calls. The chance of the > > > deadlock is small now. It happens only when there is another > > > process waiting for console_sem. > > > > Why would it *always* deadlock? If this is the case, why we don't *always* > > deadlock doing the very same wake_up_process() from console_unlock()? > > I speak about _normal_ printk() and not about printk_deferred(). > > wake_up_process() is called in console_unlock() only when > sem->wait_list is not empty, see up() in kernel/locking/semaphore.c. > printk() itself uses console_trylock() and does not wait. > > I believe that this is the rason why printk_sched() was added > so late in 2012. It was more than 10 years after adding > the semaphore into console_unlock(). IMHO, the deadlock > was rare. Of course, it was also hard to debug but it > would not take 10 years. I would not be surprise that those potential deadlocks have been existed even for 10 years. Not only that it is difficult to debug, but also when eventually someone had reported them, subsystem developers could still "kick balls" like where it had been observed for the last a few months, and no progress could be done for those as eventually life is too short and the reporters have to give up.