Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp656401imm; Thu, 31 May 2018 07:12:55 -0700 (PDT) X-Google-Smtp-Source: ADUXVKLa1NfeXSTEHQ5cHzzw64AdCkjg4jjypYVrhLJ+2SGmGYB6OqGvStojIzaiRhDtt86/mk+Y X-Received: by 2002:a62:20c7:: with SMTP id m68-v6mr6905152pfj.110.1527775975460; Thu, 31 May 2018 07:12:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527775975; cv=none; d=google.com; s=arc-20160816; b=xY23g4fjiKo073c9eW5VgiM1WDntSPjVff0cNGv72Hys+xJ3QLuTbTFK4ZDx6TSMvX G7r5ZyDhJAhMmDbSR5OwDaNERbpeWO3mAHTL+uWDD09il7uBe6G6o8PL6zRuu70XfG0K p5EQ5DdH2RUxEAGDXOwTokGaY5WQij3kjAR3+jySC2ENLSvEcap1bTY+elwLeQHpHEDY kFs5iypCr0adRwF6yWTYDN+z8gG/1T+VjPPqI67ZZtKXW655q2BR6cAbJqssZsqryNIZ KhO7ZouXUOYxYe/s7dFJvAsxMObx7Obz0AkltbfIa2dXfuPCG0ccGlLd6dsfndada40t 019A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:feedback-id:mime-version:user-agent :references:message-id:in-reply-to:subject:cc:to:from:date :dkim-signature:arc-authentication-results; bh=pkJmtHHHlba9Rg7WZcQ7ryhNsNrmPRHQ4j3TiSiI5NU=; b=R2CkislqEZ/YyRyhW5Y274ltuKQoiM+uPCUbrXXHOEl7NN2NCEbXc7QITC72wNZLy7 kn/JXOVAtTZjKJ3FC4wTrvm1IYLHxdXb+/3K7tar7oGVmR8M6f/23yoeuHalJDoWUv47 T5cyTOuT8n9EgMrIzAWEAJdcoIq8UkvaQmYhlpTg2j42m5Ec+1tzlFTbmO91VMRaDSzl 98J9ubUIj255LdIGG5IznQvs6E+sEe/4xtMv3q5t8hgQkpgPoi5wugH2WXwWzVZEZELc LrVV4pnb4WjJuRwXe1RJw8T6ZpPz/yVK8/aZiQB17YReIXD9PVWRQpSp1vCH8X2k49Zd as2A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amazonses.com header.s=ug7nbtf4gccmlpwj322ax3p6ow6yfsug header.b=a2rERrpy; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id w3-v6si2245454pgc.645.2018.05.31.07.12.41; Thu, 31 May 2018 07:12:55 -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=@amazonses.com header.s=ug7nbtf4gccmlpwj322ax3p6ow6yfsug header.b=a2rERrpy; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755301AbeEaOMB (ORCPT + 99 others); Thu, 31 May 2018 10:12:01 -0400 Received: from a9-54.smtp-out.amazonses.com ([54.240.9.54]:48936 "EHLO a9-54.smtp-out.amazonses.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755202AbeEaOMB (ORCPT ); Thu, 31 May 2018 10:12:01 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/simple; s=ug7nbtf4gccmlpwj322ax3p6ow6yfsug; d=amazonses.com; t=1527775920; h=Date:From:To:cc:Subject:In-Reply-To:Message-ID:References:MIME-Version:Content-Type:Feedback-ID; bh=5GedCk1WS587YqIBVmZugoi47f20TL2VVj5aZlZ+UiY=; b=a2rERrpyVzjoBEw+UD7XnQX5MHCeQMvFjydEaWyBvsaFLi1SEE17ixymgkW9MXnE 2jhe4cnifROK+iiA0G5xNK1h3HOOc99v8l6UbAi0wIdtWy4MRbubjWT6JHfjPQ331iu LtfGvR7fD4b+ViNwKi6yAZuLseFnR9XjWJgKvCgs= Date: Thu, 31 May 2018 14:12:00 +0000 From: Christopher Lameter X-X-Sender: cl@nuc-kabylake To: Matthew Wilcox cc: Jia-Ju Bai , penberg@kernel.org, rientjes@google.com, iamjoonsoo.kim@lge.com, akpm@linux-foundation.org, linux-mm@kvack.org, Linux Kernel Mailing List Subject: Re: Can kfree() sleep at runtime? In-Reply-To: <20180531140808.GA30221@bombadil.infradead.org> Message-ID: <01000163b68a8026-56fb6a35-040b-4af9-8b73-eb3b4a41c595-000000@email.amazonses.com> References: <30ecafd7-ed61-907b-f924-77fc37dcc753@gmail.com> <20180531140808.GA30221@bombadil.infradead.org> User-Agent: Alpine 2.21 (DEB 202 2017-01-01) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII X-SES-Outgoing: 2018.05.31-54.240.9.54 Feedback-ID: 1.us-east-1.fQZZZ0Xtj2+TD7V5apTT/NrT6QKuPgzCT/IC7XYgDKI=:AmazonSES Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 31 May 2018, Matthew Wilcox wrote: > On Thu, May 31, 2018 at 09:10:07PM +0800, Jia-Ju Bai wrote: > > I write a static analysis tool (DSAC), and it finds that kfree() can sleep. > > > > Here is the call path for kfree(). > > Please look at it *from the bottom up*. > > > > [FUNC] alloc_pages(GFP_KERNEL) > > arch/x86/mm/pageattr.c, 756: alloc_pages in split_large_page > > arch/x86/mm/pageattr.c, 1283: split_large_page in __change_page_attr > > Here's your bug. Coming from kfree(), we can't end up in the > split_large_page() path. __change_page_attr may be called in several > different circumstances in which it would have to split a large page, > but the path from kfree() is not one of them. Freeing a page in the page allocator also was traditionally not sleeping. That has changed?