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=-5.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS 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 92C1BC433E0 for ; Thu, 11 Mar 2021 12:49:21 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 0A0DC64FE0 for ; Thu, 11 Mar 2021 12:49:20 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 0A0DC64FE0 Authentication-Results: mail.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=suse.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 585FF8D02B9; Thu, 11 Mar 2021 07:49:20 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 524378D02B2; Thu, 11 Mar 2021 07:49:20 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 3C36A8D02B9; Thu, 11 Mar 2021 07:49:20 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0060.hostedemail.com [216.40.44.60]) by kanga.kvack.org (Postfix) with ESMTP id 206838D02B2 for ; Thu, 11 Mar 2021 07:49:20 -0500 (EST) Received: from smtpin14.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id B380F180ACEE8 for ; Thu, 11 Mar 2021 12:49:19 +0000 (UTC) X-FDA: 77907574038.14.9426F2A Received: from mx2.suse.de (mx2.suse.de [195.135.220.15]) by imf08.hostedemail.com (Postfix) with ESMTP id E556C8019143 for ; Thu, 11 Mar 2021 12:49:11 +0000 (UTC) X-Virus-Scanned: by amavisd-new at test-mx.suse.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1615466958; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=D4xUYx/BDSZxiqahQ+yhhPAeEk7mnpJi5OROTIn6COI=; b=CjUV+LYOCvcnM6tveQ54vicvPtfku/X34ZAVkFBMuWL8JaZdNBL0DsMAk/egV1uFDdmugf ChFcSUsMbg8e02lMtgZ60Nsrpuoujxlzyk23/Boe0OKUUgeySF/UUOuOLrHc5MNcx5FR9P 8OPqgJoI8VVGQz1Lw1CysvrNcZGoXHQ= Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id D78DDAC17; Thu, 11 Mar 2021 12:49:17 +0000 (UTC) Date: Thu, 11 Mar 2021 13:49:17 +0100 From: Michal Hocko To: Peter Zijlstra Cc: Mike Kravetz , linux-mm@kvack.org, linux-kernel@vger.kernel.org, "Paul E . McKenney" , Shakeel Butt , tglx@linutronix.de, john.ogness@linutronix.de, urezki@gmail.com, ast@fb.com, Eric Dumazet , Mina Almasry , Andrew Morton Subject: Re: [PATCH] hugetlb: select PREEMPT_COUNT if HUGETLB_PAGE for in_atomic use Message-ID: References: <20210311021321.127500-1-mike.kravetz@oracle.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Rspamd-Server: rspam04 X-Rspamd-Queue-Id: E556C8019143 X-Stat-Signature: nkw6q1kn97to63dcergcq4a8yekk93ao Received-SPF: none (suse.com>: No applicable sender policy available) receiver=imf08; identity=mailfrom; envelope-from=""; helo=mx2.suse.de; client-ip=195.135.220.15 X-HE-DKIM-Result: pass/pass X-HE-Tag: 1615466951-108703 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 Thu 11-03-21 12:36:51, Peter Zijlstra wrote: [...] > Also, Linus hates constructs like this: > > https://lkml.kernel.org/r/CAHk-=wht7kAeyR5xEW2ORj7m0hibVxZ3t+2ie8vNHLQfdbN2_g@mail.gmail.com Btw. I would really appreciate if somebody would explain why it is _fundamentally broken_ to check for an atomic context and chose a different handling in a code path, like put_page, which is out of hands of the called context? This can be called from a wide variety of contexts. There is no way to pass a context information to the called function. I do recognize that this is not an act of beauty but why fundamentally broken? The put_page context can certainly work towards robustness and operate on the most restrictive context grounds (I really hope nobody will ever come up with an idea that put_page can be called from nmi context). This can make the code more complex and less optimal in normal case (e.g. hugetlb is almost never freed from an atomic context - one has to be really creative to achieve that). So where do we draw a line? -- Michal Hocko SUSE Labs