From patchwork Thu Nov 8 01:12:04 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wei Yang X-Patchwork-Id: 10673307 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id C447415E9 for ; Thu, 8 Nov 2018 01:12:19 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B72C52D60C for ; Thu, 8 Nov 2018 01:12:19 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id ABC7C2D61F; Thu, 8 Nov 2018 01:12:19 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 464712D62F for ; Thu, 8 Nov 2018 01:12:19 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id A98586B057E; Wed, 7 Nov 2018 20:12:17 -0500 (EST) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id A481A6B057F; Wed, 7 Nov 2018 20:12:17 -0500 (EST) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 9381D6B0580; Wed, 7 Nov 2018 20:12:17 -0500 (EST) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-pf1-f200.google.com (mail-pf1-f200.google.com [209.85.210.200]) by kanga.kvack.org (Postfix) with ESMTP id 4DB366B057E for ; Wed, 7 Nov 2018 20:12:17 -0500 (EST) Received: by mail-pf1-f200.google.com with SMTP id i19-v6so14812101pfi.21 for ; Wed, 07 Nov 2018 17:12:17 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:dkim-signature:from:to:cc:subject:date :message-id; bh=YHGjSNf2Hs7HU5Yj+mTSqWherYWccZrQy9P4Ll0ItNs=; b=c4jnf0E02xVNYi705K8XkYuS7NiEekxLwX4jQv6DhFFcxIgchi+by2BPiZwujPtMTt izhg/eIPdsqbyDvNLHsiVSrRarrWy3Q441in+OotDBrOteUGzBzDGW/5hyjq9UaJ7tmH CB1HOR4ve5GwajZ97/U/nhOXE7vNjvqqxDOGorfNjIZy+T6XhtWdsb5tqKwf8Nstw4qb TWkZ7uQ5NE/hOlGUUQTk+1unv1LYMUgBz0Zu2r4PNX+mEadgybRG9/KoPbigH0pvX7ib msBGBg/VsH0GZC36/Lrs15g6018WbD0V86+ASPDcKYxRbgfvQQEJgDsDFWIv8pQ3hwQ4 aEsw== X-Gm-Message-State: AGRZ1gLb64+1FfNtu7IuZABwro205eQwvriifqKLimg7dNJioZXoSRU+ UPII01XmKa9BImeaBgTFizxuiNxd8CLxqCqqjThC1WcTaHWSRMr7TmxUWmekfqeP5V+qd1msOxV d7Re5oOiPcjTLsW5Fk7E+vBC3LHTg56+RxuW7DdyJTxzjcZFIT8VFZ/dMQU56ds5nakT2dp70DU 3ykTMRym6UB1UmtCe+pNBGQU5+nTzcbISqZoWJ3EQKn4rFeC5bpQg7X3CJLCZs+iq1OswN5JrMF Ekk7oLHMmz6fRUzcxrvS3EGBdBQRaL6t6oTJr1vhmDnQWmtopfi5yx2YlmQq/0SrVJmDmNHh3mf aKltPxbWzpxMKtZrrY6ik7i5muuVcDidvF7C0LfeYwOSLu0BXJphwNoH3hJ616FDgar67g2ws5y d X-Received: by 2002:a62:8647:: with SMTP id x68-v6mr2697679pfd.252.1541639536837; Wed, 07 Nov 2018 17:12:16 -0800 (PST) X-Received: by 2002:a62:8647:: with SMTP id x68-v6mr2697643pfd.252.1541639535857; Wed, 07 Nov 2018 17:12:15 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1541639535; cv=none; d=google.com; s=arc-20160816; b=ovpaRhPKvS6+aQ5W/1lOyBmwuS0rju0o5ie3eyJQWK3Y2Elg1MjXWDb5pg8Zjl08Mb KFsnmYDtKQgSYHCecPj+DZnM5CC2CKraQurlnUJ2asTu5RPBnuSCzBxIHpJSWRTa3jq6 tMRUwM9hqc2af9cEkforwmkLGMTZGEJZPltS5azjQ8+02WVOBqz7y7DDGYzRlxjdJ9rg 8ObY6Vwa9zG4h1kgp3jN1KlYjvXb1MlKe3bkdhPE8zlKml+6rn+6UiUg5yA5RQah3ARy Uvz4g4JHhxrk6tV8XKdEt6Y8SLDZRSE2Af+nNVXWcmfIOkxjkAjd/QzKOlxVIaA4mFWD /HNA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=message-id:date:subject:cc:to:from:dkim-signature; bh=YHGjSNf2Hs7HU5Yj+mTSqWherYWccZrQy9P4Ll0ItNs=; b=xV1RjCeCriOdMu8ygn4B+sUqFGV4Mmeidbn+RTDfCDoRvNLtWTCgLnCW98LB8v5iZ/ fFjIY4yeRjMdmUfeDFgBLHg07cku4C63UxukG8nVYiyzsRt0GbHWqZ98Z7OjZXq9JSRG 9QMepOimw06h/oQQduLRC88J/IE8pM7ZDKQSwpGB5SiMU/4IA82bEDNhwDOF31NK3I1q V9998UFCoXYfYIQBA2ZbtMMtoZ1n/tqwO3zKhVMqqw9Qvd/QLNDgH61qYw5itl8rvduQ wwO8wwoBXjEy6dKlnKbMXPuM6AlhXSPkLfZ46DS/SdJwBz1BFZjqIR8t4d5nce+ezh5R sncA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=BLnVy1qF; spf=pass (google.com: domain of richard.weiyang@gmail.com designates 209.85.220.65 as permitted sender) smtp.mailfrom=richard.weiyang@gmail.com; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from mail-sor-f65.google.com (mail-sor-f65.google.com. [209.85.220.65]) by mx.google.com with SMTPS id z20-v6sor2965088pgf.81.2018.11.07.17.12.15 for (Google Transport Security); Wed, 07 Nov 2018 17:12:15 -0800 (PST) Received-SPF: pass (google.com: domain of richard.weiyang@gmail.com designates 209.85.220.65 as permitted sender) client-ip=209.85.220.65; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=BLnVy1qF; spf=pass (google.com: domain of richard.weiyang@gmail.com designates 209.85.220.65 as permitted sender) smtp.mailfrom=richard.weiyang@gmail.com; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=YHGjSNf2Hs7HU5Yj+mTSqWherYWccZrQy9P4Ll0ItNs=; b=BLnVy1qFJ3zf0RSzoOmzUDygS0pScMI05YvCQGNv5b7u4AWyYv2g/draz/OL0VUg1X o8ycWBYBC1v1aNH02+vFmHdu959S3qR2mvII2AiceBe6erYigi2LNWF+f/XzluUQMBvo 2tK82BCq3cEiet5btC/fhe0Ihyq8NZTOVYOrWahZ7qOtb67qe09RlMh0Jup3xNqg0UKT CTbm/z0kb9eZ+KhWq2kBJs9d4JvLNz0n06G8LUfg4SCImdOsv0URYBfLJF4me0Hkf0Za ehYjBqmod0W5zVLmeRcnfXXH4m0qxIRhP32ySe9L0EJah0pKvBQNPnlSTzkaO94x/RoK uIeQ== X-Google-Smtp-Source: AJdET5eiM2MfflVaaraUX7UgULBU2T4VYtUg2TY0124FE9EmTwrq2uNP5xtYyeRjTKnMnTXeCSkTXQ== X-Received: by 2002:a63:9e58:: with SMTP id r24mr2230080pgo.264.1541639535138; Wed, 07 Nov 2018 17:12:15 -0800 (PST) Received: from localhost ([185.92.221.13]) by smtp.gmail.com with ESMTPSA id 7-v6sm1754982pgk.31.2018.11.07.17.12.13 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 07 Nov 2018 17:12:14 -0800 (PST) From: Wei Yang To: cl@linux.com, penberg@kernel.org Cc: akpm@linux-foundation.org, linux-mm@kvack.org, Wei Yang Subject: [PATCH] mm/slub: skip node in case there is no slab to acquire Date: Thu, 8 Nov 2018 09:12:04 +0800 Message-Id: <20181108011204.9491-1-richard.weiyang@gmail.com> X-Mailer: git-send-email 2.15.1 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: X-Virus-Scanned: ClamAV using ClamSMTP for_each_zone_zonelist() iterates the zonelist one by one, which means it will iterate on zones on the same node. While get_partial_node() checks available slab on node base instead of zone. This patch skip a node in case get_partial_node() fails to acquire slab on that node. Signed-off-by: Wei Yang --- mm/slub.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/mm/slub.c b/mm/slub.c index e3629cd7aff1..97a480b5dfb9 100644 --- a/mm/slub.c +++ b/mm/slub.c @@ -1873,7 +1873,7 @@ static void *get_partial_node(struct kmem_cache *s, struct kmem_cache_node *n, * Get a page from somewhere. Search in increasing NUMA distances. */ static void *get_any_partial(struct kmem_cache *s, gfp_t flags, - struct kmem_cache_cpu *c) + struct kmem_cache_cpu *c, int except) { #ifdef CONFIG_NUMA struct zonelist *zonelist; @@ -1882,6 +1882,9 @@ static void *get_any_partial(struct kmem_cache *s, gfp_t flags, enum zone_type high_zoneidx = gfp_zone(flags); void *object; unsigned int cpuset_mems_cookie; + nodemask_t nmask = node_states[N_MEMORY]; + + node_clear(except, nmask); /* * The defrag ratio allows a configuration of the tradeoffs between @@ -1908,7 +1911,8 @@ static void *get_any_partial(struct kmem_cache *s, gfp_t flags, do { cpuset_mems_cookie = read_mems_allowed_begin(); zonelist = node_zonelist(mempolicy_slab_node(), flags); - for_each_zone_zonelist(zone, z, zonelist, high_zoneidx) { + for_each_zone_zonelist_nodemask(zone, z, zonelist, + high_zoneidx, &nmask) { struct kmem_cache_node *n; n = get_node(s, zone_to_nid(zone)); @@ -1926,6 +1930,7 @@ static void *get_any_partial(struct kmem_cache *s, gfp_t flags, */ return object; } + node_clear(zone_to_nid(zone), nmask); } } } while (read_mems_allowed_retry(cpuset_mems_cookie)); @@ -1951,7 +1956,7 @@ static void *get_partial(struct kmem_cache *s, gfp_t flags, int node, if (object || node != NUMA_NO_NODE) return object; - return get_any_partial(s, flags, c); + return get_any_partial(s, flags, c, searchnode); } #ifdef CONFIG_PREEMPT