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=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 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 6519CC2D0BF for ; Mon, 16 Dec 2019 16:17:12 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 20B822067C for ; Mon, 16 Dec 2019 16:17:12 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="bFL7SkAT" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 20B822067C Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id C2CF08E0007; Mon, 16 Dec 2019 11:17:11 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id BB5C88E0003; Mon, 16 Dec 2019 11:17:11 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id AA3EE8E0007; Mon, 16 Dec 2019 11:17:11 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0080.hostedemail.com [216.40.44.80]) by kanga.kvack.org (Postfix) with ESMTP id 8FF458E0003 for ; Mon, 16 Dec 2019 11:17:11 -0500 (EST) Received: from smtpin21.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with SMTP id 45E5D82499A8 for ; Mon, 16 Dec 2019 16:17:11 +0000 (UTC) X-FDA: 76271509062.21.news06_46c755a7491a X-HE-Tag: news06_46c755a7491a X-Filterd-Recvd-Size: 3930 Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [207.211.31.120]) by imf31.hostedemail.com (Postfix) with ESMTP for ; Mon, 16 Dec 2019 16:17:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1576513029; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=SGboJs7KZvOzsfpiuzionVG44ptHGHTF9gI/gQLgP/M=; b=bFL7SkATnD15pNSF1PQxRGfzC0GmDj8v4YL3cDOxhh8aAEaqebWZmPig8bb4npfuqkN9he pmVZvX6iSsJQ+3nFxugz9kwhQ2DCw4j7syuYEuGvlRguCDyTqi4HyLRO+Eiiqgv9T8PA/g UyPF9Kw7AIZFzqb8zRlmGbRYylqL+V8= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-77-9fKLxG4SPxSMLifbOpgTLg-1; Mon, 16 Dec 2019 11:17:04 -0500 X-MC-Unique: 9fKLxG4SPxSMLifbOpgTLg-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 72125800C79; Mon, 16 Dec 2019 16:17:02 +0000 (UTC) Received: from llong.remote.csb (dhcp-17-59.bos.redhat.com [10.18.17.59]) by smtp.corp.redhat.com (Postfix) with ESMTP id 5438D5D9C9; Mon, 16 Dec 2019 16:17:01 +0000 (UTC) Subject: Re: [PATCH v2] mm/hugetlb: defer free_huge_page() to a workqueue To: Michal Hocko , Davidlohr Bueso Cc: Andrew Morton , Mike Kravetz , Matthew Wilcox , linux-kernel@vger.kernel.org, linux-mm@kvack.org, aneesh.kumar@linux.ibm.com References: <20191211194615.18502-1-longman@redhat.com> <4fbc39a9-2c9c-4c2c-2b13-a548afe6083c@oracle.com> <32d2d4f2-83b9-2e40-05e2-71cd07e01b80@redhat.com> <0fcce71f-bc20-0ea3-b075-46592c8d533d@oracle.com> <20191212060650.ftqq27ftutxpc5hq@linux-p48b> <20191212063050.ufrpij6s6jkv7g7j@linux-p48b> <20191212190427.ouyohviijf5inhur@linux-p48b> <20191216133711.GH30281@dhcp22.suse.cz> From: Waiman Long Organization: Red Hat Message-ID: Date: Mon, 16 Dec 2019 11:17:00 -0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.7.2 MIME-Version: 1.0 In-Reply-To: <20191216133711.GH30281@dhcp22.suse.cz> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Content-Language: en-US X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 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 12/16/19 8:37 AM, Michal Hocko wrote: > On Thu 12-12-19 11:04:27, Davidlohr Bueso wrote: >> There have been deadlock reports[1, 2] where put_page is called >> from softirq context and this causes trouble with the hugetlb_lock, >> as well as potentially the subpool lock. >> >> For such an unlikely scenario, lets not add irq dancing overhead >> to the lock+unlock operations, which could incur in expensive >> instruction dependencies, particularly when considering hard-irq >> safety. For example PUSHF+POPF on x86. >> >> Instead, just use a workqueue and do the free_huge_page() in regular >> task context. > I am afraid that work_struct is too large to be stuffed into the struct > page array (because of the lockdep part). > > I think that it would be just safer to make hugetlb_lock irq safe. Are > there any other locks that would require the same? Currently, free_huge_page() can be called from the softIRQ context. The hugetlb_lock will be acquired during that call. The subpool lock may conditionally be acquired as well. I am still torn between converting both locks to be irq-safe or deferring the freeing to a workqueue. Cheers, Longman