Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp737871pxk; Thu, 1 Oct 2020 12:33:52 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzxCKqBqmebCmXfuRlfeXCO+Zo/wTo1gJR8rJvdKMKf/0h5Op4YtcRkKG0A4PpbHIMha1LQ X-Received: by 2002:a17:906:bc91:: with SMTP id lv17mr3576110ejb.249.1601580831877; Thu, 01 Oct 2020 12:33:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1601580831; cv=none; d=google.com; s=arc-20160816; b=uvyTRzm0bjESOwyT5R1LIrDByLm2Wo8JApYuJ7mqHUOU3AkPdSfjZy7+qu4OcNF87Y FhgpDK75A2UIp+Ei5b6Gx/vdDgcM6/t6X2qI3ypbb/rzQqKplKtg/WCuGM1lxcVQAAcC nvt3k3hpPxqvJqbf8qWBgwM0e0nozWzyLoPgj06tFSEo/iq/re0NG68T7VdqHEt6UKpW 4yAxRn+zxEagUaRwiQNXzjCwXcJFpiAYQAlIB6/sM2y+d604j2spfcEXce30GS90FDC+ sQePgQ19svzUHGm99YDf4auMlrfVUBG1gn9mo1V2RASHIos5KgGtsUx/xZoYQ5NG66xz lTkg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:date:from :dkim-signature; bh=YnQw5I7E0IE6Jm9/sjhCU27Hvf+BvkH1b7yFmJGMXJk=; b=kaC974BXNNIeSXlw17BOHbUETVS1PVL3R9obDUNi+xxcqvfG3HcdP3c8AD9b6JkGnO Ml6aJYjfi9BSRkamp46b096qt/s/zZ7M70LjQulsQmk+8FhRuUsuXvkkPfIWBcrYDLDW Aokd8iFpVTlecLfC/7+fwXu1se9p+bzBMyaBDcsGh9E49L/NvMkLr5B5J53zZ7v+1JV1 5wqJq/ZJWT0V79i2gBFfbLBb7wA3NKIivnG5V+dNKT8zaQKQ9jriSg1rxzszy0fnVwPN 648duajS1pRVtRpHmLZi/CNvaFVPw96JB+JPxkO8vjOo6MK4vuA+Za97Kcd3YWvQwAS5 Plew== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=IQ0Q7Hih; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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. [23.128.96.18]) by mx.google.com with ESMTP id h6si4952675ejq.347.2020.10.01.12.33.27; Thu, 01 Oct 2020 12:33:51 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=IQ0Q7Hih; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 S1732522AbgJATcV (ORCPT + 99 others); Thu, 1 Oct 2020 15:32:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48200 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729990AbgJATcV (ORCPT ); Thu, 1 Oct 2020 15:32:21 -0400 Received: from mail-lf1-x144.google.com (mail-lf1-x144.google.com [IPv6:2a00:1450:4864:20::144]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E96B6C0613D0; Thu, 1 Oct 2020 12:32:20 -0700 (PDT) Received: by mail-lf1-x144.google.com with SMTP id x69so36855lff.3; Thu, 01 Oct 2020 12:32:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:date:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=YnQw5I7E0IE6Jm9/sjhCU27Hvf+BvkH1b7yFmJGMXJk=; b=IQ0Q7HihNmj2N5gtPNicajIxU3n0fnaxqryKbRbt6ce7eRM0pbTr8HZLRz3+spOa1N fppFiOHxIf8sg0OuN4Wqru3+khhlkn4eYqy8tt97TfZ2WY3Nu5Pd1vPeRHMAg4ZZrfiW Wjy3MyK2RYM3c/znLxcqU2omMUhRpo7eO0nagsFktLt6/HgzZVxamu88gEWRC/fKHPp/ v80LAcDmsu4iAELmIXZtTDLS9nnndOJIs0i/DLuH9B7E6W+1kKJb456TZv8SOxT/tna4 lh+KzSDq/RXhwvH5yZvxoqLEkRifzyaEDOxmomenDOWqhK0OXarCMmsAWDLYpCthz5z2 7ujQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:date:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=YnQw5I7E0IE6Jm9/sjhCU27Hvf+BvkH1b7yFmJGMXJk=; b=T9vJlr4rHku6MkXEP4HJoTNg6Rdw/SmgdQSua2dRRZrHOO/5EDacM8PcTRCDeketdy V41cgHuoByExkeNXcoie/jfP+8bGEC2EZAPbE0YrZKKKj/fCrUnEHWWKbwCjZF5XWxRk zqdlVXNYnK00UdRb0AyaZIZS+ZMzEvcIVmaWUorFgoHesgptR9kqIhFVwppmgjxO3FUB zJUZSWghz5ESNf7GtNVGMH02Ijlgran8WIVxKeiBRjRg00CqlwcOQIqWrYzv5dGuMTJ+ kEB/OjeLMxM4N3DRn3rgTgyrCkX8SuKk/b1DBVm/NEHAyGrHW4eYGzkCrjJ+saRnXjyb vjPA== X-Gm-Message-State: AOAM532wBv+fS/yD1eMmidju0Sj+APT3XRtGEXRCOOuiK5ygbJvqaU3O sLzm6j33kC+6w5hDszdX64fQy+p+jcJftwMJ X-Received: by 2002:a05:6512:403:: with SMTP id u3mr3015161lfk.10.1601580739284; Thu, 01 Oct 2020 12:32:19 -0700 (PDT) Received: from pc636 (h5ef52e31.seluork.dyn.perspektivbredband.net. [94.245.46.49]) by smtp.gmail.com with ESMTPSA id 10sm669191lfo.197.2020.10.01.12.32.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 01 Oct 2020 12:32:18 -0700 (PDT) From: Uladzislau Rezki X-Google-Original-From: Uladzislau Rezki Date: Thu, 1 Oct 2020 21:32:16 +0200 To: Michal Hocko Cc: Uladzislau Rezki , Vlastimil Babka , LKML , RCU , linux-mm@kvack.org, Andrew Morton , "Paul E . McKenney" , Peter Zijlstra , Thomas Gleixner , "Theodore Y . Ts'o" , Joel Fernandes , Sebastian Andrzej Siewior , Oleksiy Avramchenko , Mel Gorman Subject: Re: [RFC-PATCH 2/4] mm: Add __rcu_alloc_page_lockless() func. Message-ID: <20201001193216.GB29606@pc636> References: <20200918194817.48921-1-urezki@gmail.com> <20200918194817.48921-3-urezki@gmail.com> <38f42ca1-ffcd-04a6-bf11-618deffa897a@suse.cz> <20200929220742.GB8768@pc636> <20200930103557.GQ2277@dhcp22.suse.cz> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200930103557.GQ2277@dhcp22.suse.cz> User-Agent: Mutt/1.10.1 (2018-07-13) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Sep 30, 2020 at 12:35:57PM +0200, Michal Hocko wrote: > On Wed 30-09-20 00:07:42, Uladzislau Rezki wrote: > [...] > > > > bool is_pcp_cache_empty(gfp_t gfp) > > { > > struct per_cpu_pages *pcp; > > struct zoneref *ref; > > unsigned long flags; > > bool empty; > > > > ref = first_zones_zonelist(node_zonelist( > > numa_node_id(), gfp), gfp_zone(gfp), NULL); > > if (!ref->zone) > > return true; > > > > local_irq_save(flags); > > pcp = &this_cpu_ptr(ref->zone->pageset)->pcp; > > empty = list_empty(&pcp->lists[gfp_migratetype(gfp)]); > > local_irq_restore(flags); > > > > return empty; > > } > > > > disable_irq(); > > if (!is_pcp_cache_empty(GFP_NOWAIT)) > > __get_free_page(GFP_NOWAIT); > > enable_irq(); > > > > > > Do you mean to have something like above? I mean some extra API > > function that returns true or false if fast-fast allocation can > > either occur or not. Above code works just fine and never touches > > main zone->lock. > > The above code works with the _current_ implementation and it restricts > its implementation to some degree. Future changes might get harder to > implement with a pattern like this. I do not think we want users to be > aware of internal implementation details like pcp caches, migrate types > or others. While pcp caches are here for years and unlikely to change in > a foreseeable future many details are changing on regular basis. > I see your view. That was en example for better understanding. Thanks. -- Vlad Rezki