Received: by 10.223.185.116 with SMTP id b49csp979006wrg; Fri, 16 Feb 2018 10:12:56 -0800 (PST) X-Google-Smtp-Source: AH8x224nrPY8N2bQ0uwQxBOXFTz84Dg0VBbUhQkYVT8qh7o7RInb3z7LoENi7kGnH6OqGcHPVQjf X-Received: by 2002:a17:902:6b87:: with SMTP id p7-v6mr6665932plk.9.1518804776448; Fri, 16 Feb 2018 10:12:56 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518804776; cv=none; d=google.com; s=arc-20160816; b=WTYU7Eo38eKEuAj1+qHscAYD4LiGaJPsUKuABnguqqkVGQPkET4qRYqrls8fQd5bZz 7Ou3saTWV5KROi67O+lyMNvpHEo3t2AnDTzU3AY8aLNFqYyKI6hsuitOEz+7FRXYHtX1 Zol+GRdOgle3/q5T0kVUD7OWtTzUuOxkn23ymxis8n3RsssYQiLTcnDBZHAjtU4DnsFy Wo5SlpF0Ye2NZEIdLGKiO4kdSa1AlSXVpNde0B6NDAlEtDir0FU6p1eT3fZfCoEdNzm/ R8BJ+9YWQfokH6KW74Gon2/kFOMyNn+DcybXsLIhLHIbUcH6F8+S8MFlDNjU8lrrWbQ0 GnXw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature:arc-authentication-results; bh=hfk18mwrERxB7GNz2OZQNZrjNqQGXcMDzYDW8zqwkqQ=; b=FbP3SgcaX/Wd/7LqclAwvFkNXR5hn0dv0b/TuU5LOosJrF/aS3eckcBudZ6+ldMuKR TUdgki8Kjg3ax4e+HZwoSdbiGDVHrN44WmX9peTqMt01z3LWQg1vW3wqmnHGfywzGvmL B1e8Dr/RPe9456XIvujuVIpYcZ0X44o9hMpoGvMwLyTP3SwOBBZjskXwVie9uUIksVI6 i7LWqI0onD3ivKLtPrCn9K/mvy9lQblwNA4VXwDNtTNU043hJ/S2kVvH2sLVsqhfeO62 CcRIjEZl49ahS2ZkwlyesyKl48mR/u/8vfLtvCNX1dozCE3+bL4onlrXJKuc/q6AXn2B SNXg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=lXUcsrSA; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id x11-v6si1676784plm.734.2018.02.16.10.12.41; Fri, 16 Feb 2018 10:12:56 -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; dkim=pass header.i=@gmail.com header.s=20161025 header.b=lXUcsrSA; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756580AbeBOXKg (ORCPT + 99 others); Thu, 15 Feb 2018 18:10:36 -0500 Received: from mail-io0-f176.google.com ([209.85.223.176]:32852 "EHLO mail-io0-f176.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756565AbeBOXKf (ORCPT ); Thu, 15 Feb 2018 18:10:35 -0500 Received: by mail-io0-f176.google.com with SMTP id n7so2453609iob.0 for ; Thu, 15 Feb 2018 15:10:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=hfk18mwrERxB7GNz2OZQNZrjNqQGXcMDzYDW8zqwkqQ=; b=lXUcsrSATJukh9VqIpsWfckoAufzvHJZLRXwidT7BZuV44vQVCah/UGclqUFGntPhJ dHOa6sbNW0G5ay975fmk4kWG3UdhgxwKgwYEqWGmtTb0PQenmo0WgmMswBmd81FQkhQ+ iUcJhw2EtSFrAOyHzHXbdyQ3NqxuBULi7+jeoUx8vSqAZkGdrTkCCVoZEnLE0KabGZt4 B12D7oi5dRmSNHaVTFnwUcLkL5NUpMINJsZAjOfWfhtAyDnQMrglGRW8/nysYV6Fgnwf OoksBQ8w3cYFJyk1qi5c9kcItA/lLMXkeAwvxmlidBPRSF6bfIvu3Np4R8VT4aDUNByc F7NQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=hfk18mwrERxB7GNz2OZQNZrjNqQGXcMDzYDW8zqwkqQ=; b=h/oVRAeKH+lpif82op5gEVwiZ508T8jooiA47ML8/+fLYRSUdntz93cjblbOknprhw gDfsW5xy1kM8LKizWbSvIIkJJ5plidhFMUQD/mOlkuiRPymF3huvzCrRjsc1luf2zFYG XXJ1J6TpOuWWVRkmuwJD9h9DzEZ1oXgeKWiOjYJAetTUrs0BlsGSPoKKvdVJSs1mCzFf /lYTgRklHXxfgQ7Yt6JViTlXqa2LTO4sUT0YNhOQaz3NN3x+bb1nKGTQoIZojdxRJwPA dVRwVeU/74n+ueq0DLPaD5Wger0oYV6lqGx3ywOB3avhPndSgPw01X72MwqAx4n52gnI 9UiQ== X-Gm-Message-State: APf1xPAy5gEx2OswAYIp7xzKKVterUCZKa0FWkoL9uWVXCA+9hp7bpxd 1US333Dd/BzQKWtHwD+Wkjh6lMpIeuc= X-Received: by 10.107.22.199 with SMTP id 190mr6199953iow.242.1518736234404; Thu, 15 Feb 2018 15:10:34 -0800 (PST) Received: from localhost (172-220-001-224.dhcp.chtrptr.net. [172.220.1.224]) by smtp.gmail.com with ESMTPSA id y81sm354878ioy.29.2018.02.15.15.10.32 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 15 Feb 2018 15:10:33 -0800 (PST) Date: Thu, 15 Feb 2018 17:10:27 -0600 From: Dennis Zhou To: Tejun Heo Cc: Christoph Lameter , Daniel Borkmann , linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 2/3] percpu: add __GFP_NORETRY semantics to the percpu balancing path Message-ID: <20180215231027.GA79973@localhost> References: <20180215213909.GU695913@devbig577.frc2.facebook.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180215213909.GU695913@devbig577.frc2.facebook.com> User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Tejun, On Thu, Feb 15, 2018 at 01:39:09PM -0800, Tejun Heo wrote: > On Thu, Feb 15, 2018 at 10:08:15AM -0600, Dennis Zhou wrote: > > -static struct pcpu_chunk *pcpu_create_chunk(void) > > +static struct pcpu_chunk *pcpu_create_chunk(gfp_t gfp) > > { > > const int nr_pages = pcpu_group_sizes[0] >> PAGE_SHIFT; > > struct pcpu_chunk *chunk; > > struct page *pages; > > int i; > > > > - chunk = pcpu_alloc_chunk(); > > + chunk = pcpu_alloc_chunk(gfp); > > if (!chunk) > > return NULL; > > > > - pages = alloc_pages(GFP_KERNEL, order_base_2(nr_pages)); > > + pages = alloc_pages(gfp | GFP_KERNEL, order_base_2(nr_pages)); > > Is there a reason to set GFP_KERNEL in this function? I'd prefer > pushing this to the callers. > Not particularly. As I wasn't sure of the original decision to use GFP_KERNEL for all percpu underlying allocations, I didn't want to add the gfp passthrough and remove functionality. > > diff --git a/mm/percpu-vm.c b/mm/percpu-vm.c > > index 9158e5a..ea9906a 100644 > > --- a/mm/percpu-vm.c > > +++ b/mm/percpu-vm.c > > @@ -37,7 +37,7 @@ static struct page **pcpu_get_pages(void) > > lockdep_assert_held(&pcpu_alloc_mutex); > > > > if (!pages) > > - pages = pcpu_mem_zalloc(pages_size); > > + pages = pcpu_mem_zalloc(pages_size, 0); > ^^^^ > because this is confusing Yeah.. The next patch removes this as the additional gfp flags is weird. > > static int pcpu_alloc_pages(struct pcpu_chunk *chunk, > > - struct page **pages, int page_start, int page_end) > > + struct page **pages, int page_start, int page_end, > > + gfp_t gfp) > > { > > - const gfp_t gfp = GFP_KERNEL | __GFP_HIGHMEM; > > unsigned int cpu, tcpu; > > int i; > > > > + gfp |= GFP_KERNEL | __GFP_HIGHMEM; > ^^ > double space > I'll fix this with any other updates. > So, setting __GFP_HIGHMEM unconditionally here makes sense because > it's indicating the types of pages we can use (we also accept high > pages); however, I'm not sure GFP_KERNEL makes sense. That's about > "how to allocate" and looks like it should be left to the caller. > That makes sense, I can remove the forced GFP_KERNEL use in the next patch as that patch moves the flags to the caller. I'd rather be explicit though and whitelist GFP_KERNEL as I don't have a full grasp of all the flags. Our use case is a little different because we ultimately become the owner of the pages until the chunk is freed. So there are certain flags such as __GFP_HARDWALL (poor example), the difference between GFP_KERNEL and GFP_USER, which don't make sense here. Regarding high pages, I think you're referring to GFP_ATOMIC allocations? We actually never allocate on this path as allocations must be served out of parts of chunks that are already backed. Thanks, Dennis