Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp35385ybl; Thu, 12 Dec 2019 13:34:29 -0800 (PST) X-Google-Smtp-Source: APXvYqyOBdOlWF9dpeX5MoysOcLq0TR0QExEtBg7UPk2XX2B8HD1g+bHyzJqtIizOU1LdhKmWwlL X-Received: by 2002:a9d:4d01:: with SMTP id n1mr9943503otf.245.1576186468955; Thu, 12 Dec 2019 13:34:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1576186468; cv=none; d=google.com; s=arc-20160816; b=EDvzB6ofRHUrcg2G9M52drRT9yRM/lrRUEYdbpm9O/owECHxLRxMqT+sQcVATd1WFh 027A8wYMz/LxV6MzRBjKqq6c1mBh4HFPDJEdOS8l3zg70rxGNtoUIXEpOksTynLOIwM4 Sj2CICA7PyTwtdqtoA3elDlXNx9Qj+OXdO9W6E3be+YUjWbyOaJWNtJbqMNqqrpG7F0f EaAKChWKYvCqZemgXfAqTsVrM2cFoo1L53pXjRWYbqMEsDb0g6ZrAmPwE5vfJw/cxOfP jFcGzLGVFNh2OHbAleYv00UuErURGqX2zZIF4KKqadoa71hBKuUoWBVvvlAbvLVewcFR TD4w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:message-id :in-reply-to:date:references:subject:cc:to:from; bh=NrfpEgJaHWzPiszTRf1WDrn3CkDKrtHGF46EDkvjWUE=; b=HSn2DT9cnnfsHPX4P5lPS75sVkWWyw/8+oCS4PZAORILyUBwvRAO5MNLQQhZ9A0Yqt RD/I5jOR5qkaWiKDgp8jhrsbfBx9QqHDwXjegtJleQtTKA42oZDBOpGnT/36QFK0Y3F5 uRgIKwjUMmGr3kbdnormKHuErTKnCH9Di9g1q41XeySIIwSTpchRQvQlO91Uoxg8DTgl EScKoAJVIhgSpGfXR398hEkxMOV+ySm3r01QV9MEa4KyH3sZDP5z8riEhuFU9Xaq33Cc 6liOjb1E/nqSPGJtenFv4EKjV2bbITBuBECDt4Fno9QzEk8Gx/AYuf8X2hhbWrlkqd1W yqVg== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e17si3894943oti.89.2019.12.12.13.34.16; Thu, 12 Dec 2019 13:34:28 -0800 (PST) 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731119AbfLLVck (ORCPT + 99 others); Thu, 12 Dec 2019 16:32:40 -0500 Received: from mga06.intel.com ([134.134.136.31]:8358 "EHLO mga06.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730902AbfLLVck (ORCPT ); Thu, 12 Dec 2019 16:32:40 -0500 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga003.jf.intel.com ([10.7.209.27]) by orsmga104.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 12 Dec 2019 13:32:39 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.69,307,1571727600"; d="scan'208";a="216426268" Received: from tassilo.jf.intel.com (HELO tassilo.localdomain) ([10.7.201.21]) by orsmga003.jf.intel.com with ESMTP; 12 Dec 2019 13:32:39 -0800 Received: by tassilo.localdomain (Postfix, from userid 1000) id DE8C330038C; Thu, 12 Dec 2019 13:32:39 -0800 (PST) From: Andi Kleen To: Mike Kravetz Cc: Waiman Long , Matthew Wilcox , Andrew Morton , linux-kernel@vger.kernel.org, linux-mm@kvack.org, Michal Hocko Subject: Re: [PATCH v2] hugetlbfs: Disable softIRQ when taking hugetlb_lock 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> Date: Thu, 12 Dec 2019 13:32:39 -0800 In-Reply-To: <20191212060650.ftqq27ftutxpc5hq@linux-p48b> (Davidlohr Bueso's message of "Wed, 11 Dec 2019 22:06:50 -0800") Message-ID: <871rt99qmg.fsf@linux.intel.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Davidlohr Bueso writes: > +void free_huge_page(struct page *page) > +{ > + struct hugetlb_free_page_work work; > + > + work.page = page; > + INIT_WORK_ONSTACK(&work.work, free_huge_page_workfn); > + queue_work(hugetlb_free_page_wq, &work.work); > + > + /* > + * Wait until free_huge_page is done. > + */ > + flush_work(&work.work); > + destroy_work_on_stack(&work.work); Does flushing really work in softirq context? Anyways, waiting seems inefficient over fire'n'forget You'll need a per cpu pre allocated work item and a queue. Then take a lock on the the queue and link the page into it and trigger the work item if it's not already pending. And add a in_interrupt() check of course. -Andi