From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756846AbcEaXU5 (ORCPT ); Tue, 31 May 2016 19:20:57 -0400 Received: from LGEAMRELO11.lge.com ([156.147.23.51]:40519 "EHLO lgeamrelo11.lge.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756699AbcEaXUv (ORCPT ); Tue, 31 May 2016 19:20:51 -0400 X-Original-SENDERIP: 156.147.1.125 X-Original-MAILFROM: minchan@kernel.org X-Original-SENDERIP: 10.177.223.161 X-Original-MAILFROM: minchan@kernel.org From: Minchan Kim To: Andrew Morton Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, Minchan Kim , Sergey Senozhatsky Subject: [PATCH v7 05/12] zsmalloc: use bit_spin_lock Date: Wed, 1 Jun 2016 08:21:14 +0900 Message-Id: <1464736881-24886-6-git-send-email-minchan@kernel.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1464736881-24886-1-git-send-email-minchan@kernel.org> References: <1464736881-24886-1-git-send-email-minchan@kernel.org> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Use kernel standard bit spin-lock instead of custom mess. Even, it has a bug which doesn't disable preemption. The reason we don't have any problem is that we have used it during preemption disable section by class->lock spinlock. So no need to go to stable. Reviewed-by: Sergey Senozhatsky Signed-off-by: Minchan Kim --- mm/zsmalloc.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/mm/zsmalloc.c b/mm/zsmalloc.c index 79295c73dc9f..39f29aedd5d6 100644 --- a/mm/zsmalloc.c +++ b/mm/zsmalloc.c @@ -868,21 +868,17 @@ static unsigned long obj_idx_to_offset(struct page *page, static inline int trypin_tag(unsigned long handle) { - unsigned long *ptr = (unsigned long *)handle; - - return !test_and_set_bit_lock(HANDLE_PIN_BIT, ptr); + return bit_spin_trylock(HANDLE_PIN_BIT, (unsigned long *)handle); } static void pin_tag(unsigned long handle) { - while (!trypin_tag(handle)); + bit_spin_lock(HANDLE_PIN_BIT, (unsigned long *)handle); } static void unpin_tag(unsigned long handle) { - unsigned long *ptr = (unsigned long *)handle; - - clear_bit_unlock(HANDLE_PIN_BIT, ptr); + bit_spin_unlock(HANDLE_PIN_BIT, (unsigned long *)handle); } static void reset_page(struct page *page) -- 1.9.1